Can multiple threads use same transaction concurrently?

          Is it possible that same transaction is being used by multiple threads concurrently
          in WLS? If each thread is doing suspend and resume how does it work? Does the
          transaction implementation support it? Is there a way to do it?
          

Why you don't tell us some more about your application?
          I'm assuming this is a relatively long running transaction if run
          serially. One common solution is to break this type of workflow into
          several separate transactions with queues between them.
          -- Rob
          Karambir Singh wrote:
          > Is there any workaround for this? I mean to something like explicitly associating
          > the txn with user created threads.
          >
          > "krishna" <[email protected]> wrote:
          >
          >>Transaction context cannot be propagated to user created Threads.
          >>-Krishna
          >>"Karambir Singh" <[email protected]> wrote in message
          >>news:[email protected]...
          >>
          >>>I'm starting a transaction in main thread and this thread spawns three
          >>
          >>threads.
          >>
          >>>I want updates done in main transaction and updates done in three child
          >>
          >>threads
          >>
          >>>to be part of the same transaction. The transaction is finally commited
          >>
          >>by
          >>main
          >>
          >>>thread.
          >>>
          >>>
          >>>
          >>>
          >>>
          >>>"Dimitri I. Rakitine" <[email protected]> wrote:
          >>>
          >>>>What are you trying to do ?
          >>>>
          >>>>Karambir Singh <[email protected]> wrote:
          >>>>
          >>>>
          >>>>>Is there any workaround to do this?
          >>>>
          >>>>>"Dimitri I. Rakitine" <[email protected]> wrote:
          >>>>>
          >>>>>>No, it is associated with a thread which started it.
          >>>>>>
          >>>>>>Karambir Singh <[email protected]> wrote:
          >>>>>>
          >>>>>>
          >>>>>>>Is it possible that same transaction is being used by multiple
          >>
          >>threads
          >>
          >>>>>>concurrently
          >>>>>>
          >>>>>>>in WLS? If each thread is doing suspend and resume how does it
          >>
          >>work?
          >>
          >>>>>>Does the
          >>>>>>
          >>>>>>>transaction implementation support it? Is there a way to do it?
          >>>>>>
          >>>>>>--
          >>>>>>Dimitri
          >>>>>>
          >>>>
          >>>>--
          >>>>Dimitri
          >>>>
          >>>
          >>
          >
          

Similar Messages

  • HT204053 Can multiple people use the same Apple ID for their own devices?

    Can multiple people use the same Apple ID for their own devices? I just set up my IPhone 4S (first time user) using the same Apple ID as my daughters and now we receive each others texts, do I need to set up my own Apple ID account?

    Yes, you can.  In fact it's recommended that you use different IDs for iMessage, FaceTime and iCloud.  You can still share the same ID for iTunes without any issues.
    You are getting each other's text messages because you're using the same ID for iMessage.  To fix this, one of you should go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign in with a different ID.  To avoid getting each other's FaceTime calls, do the same thing in Settings>FaceTime.

  • Can multiple threads write to the database?

    I am a little confused from the statement in the documentation: "Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time."
    1. Can multiple threads write to the "Simple Data Store"?
    2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    #include "stdafx.h"
    #include <stdio.h>
    #include <windows.h>
    #include <db.h>
    static DB *db = NULL;
    static DB_ENV *dbEnv = NULL;
    DWORD WINAPI th_write(LPVOID lpParam)
    DBT key, data;
    char key_buff[32], data_buff[32];
    DWORD i;
    printf("thread(%s) - start\n", lpParam);
    for (i = 0; i < 200; ++i)
    memset(&key, 0, sizeof(key));
    memset(&data, 0, sizeof(data));
    sprintf(key_buff, "K:%s", lpParam);
    sprintf(data_buff, "D:%s:%8d", lpParam, i);
    key.data = key_buff;
    key.size = strlen(key_buff);
    data.data = data_buff;
    data.size = strlen(data_buff);
    db->put(db, NULL, &key, &data, 0);
    Sleep(5);
    printf("thread(%s) - End\n", lpParam);
    return 0;
    int main()
    db_env_create(&dbEnv, 0);
    dbEnv->open(dbEnv, NULL, DB_CREATE | DB_INIT_MPOOL | DB_THREAD, 0);
    db_create(&db, dbEnv, 0);
    db->open(db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0);
    CreateThread(NULL, 0, th_write, "A", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "C", 0, 0);
    th_write("C");
    Sleep(2000);
    }

    Here some clarification about BDB Lock and Multi threads behavior
    Question 1. Can multiple threads write to the "Simple Data Store"?
    Answer 1.
    Please Refer to http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    A Data Store (DS) set up
    (so not using an environment or using one, but without any of the DB_INIT_LOCK, DB_INIT_TXN, DB_INIT_LOG environment regions related flags specified
    each corresponding to the appropriate subsystem, locking, transaction, logging)
    will not guard against data corruption due to accessing the same database page and overwriting the same records, corrupting the internal structure of the database etc.
    (note that in the case of the Btree, Hash and Recno access methods we lock at the database page level, only for the Queue access method we lock at record level)
    So,
    if You want to have multiple threads in the application writing concurrently or in parallel to the same database You need to use locking (and properly handle any potential deadlocks),
    otherwise You risk corrupting the data itself or the database (its internal structure).
    Of course , If You serialize at the application level the access to the database, so that no more one threads writes to the database at a time, there will be no need for locking.
    But obviously this is likely not the behavior You want.
    Hence, You need to use either a CDS (Concurrent Data Store) or TDS (Transactional Data Store) set up.
    See the table comparing the various set ups, here: http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    Berkeley DB Data Store
    The Berkeley DB Data Store product is an embeddable, high-performance data store. This product supports multiple concurrent threads of control, including multiple processes and multiple threads of control within a process. However, Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time. The Berkeley DB Data Store is intended for use in read-only applications or applications which can guarantee no more than one thread of control updates the database at a time.
    Berkeley DB Concurrent Data Store
    The Berkeley DB Concurrent Data Store product adds multiple-reader, single writer capabilities to the Berkeley DB Data Store product. This product provides built-in concurrency and locking feature. Berkeley DB Concurrent Data Store is intended for applications that need support for concurrent updates to a database that is largely used for reading.
    Berkeley DB Transactional Data Store
    The Berkeley DB Transactional Data Store product adds support for transactions and database recovery. Berkeley DB Transactional Data Store is intended for applications that require industrial-strength database services, including excellent performance under high-concurrency workloads of read and write operations, the ability to commit or roll back multiple changes to the database at a single instant, and the guarantee that in the event of a catastrophic system or hardware failure, all committed database changes are preserved.
    So, clearly DS is not a solution for this case, where multiple threads need to write simultaneously to the database.
    CDS (Concurrent Data Store) provides locking features, but only for multiple-reader/single-writer scenarios. You use CDS when you specify the DB_INIT_CDB flag when opening the BDB environment: http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html#envopen_DB_INIT_CDB
    TDS (Transactional Data Store) provides locking features, adds complete ACID support for transactions and offers recoverability guarantees. You use TDS when you specify the DB_INIT_TXN and DB_INIT_LOG flags when opening the environment. To have locking support, you would need to also specify the DB_INIT_LOCK flag.
    Now, since the requirement is to have multiple writers (multi-threaded writes to the database),
    then TDS would be the way to go (CDS is useful only in single-writer scenarios, when there are no needs for recoverability).
    To Summarize
    The best way to have an understanding of what set up is needed, it is to answer the following questions:
    - What is the data access scenario? Is it multiple writer threads? Will the writers access the database simultaneously?
    - Are recoverability/data durability, atomicity of operations and data isolation important for the application? http://docs.oracle.com/cd/E17076_02/html/programmer_reference/transapp_why.html
    If the answers are yes, then TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    Question 2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    Answer 2.
    Definitely yes, You can see data loss and/or data corruption.
    You can check the behavior of your testcase in the following way
    1. Run your testcase
    2.After the program exits
    run db_verify to verify the database (db_verify -o test.db).
    You will likely see db_verify complaining, unless the thread scheduler on Windows weirdly starts each thread one after the other,
    IOW no two or ore threads write to the database at the same time -- kind of serializing the writes
    Question 3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    Answer 3.
    In Your case the TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    doing this You have proper deadlock handling in place and proper transaction usage
    so
    You are protected against potential data corruption/data loss.
    see http://docs.oracle.com/cd/E17076_02/html/gsg_txn/C/BerkeleyDB-Core-C-Txn.pdf
    Multi-threaded and Multi-process Applications
    DB is designed to support multi-threaded and multi-process applications, but their usage
    means you must pay careful attention to issues of concurrency. Transactions help your
    application's concurrency by providing various levels of isolation for your threads of control. In
    addition, DB provides mechanisms that allow you to detect and respond to deadlocks.
    Isolation means that database modifications made by one transaction will not normally be
    seen by readers from another transaction until the first commits its changes. Different threads
    use different transaction handles, so this mechanism is normally used to provide isolation
    between database operations performed by different threads.
    Note that DB supports different isolation levels. For example, you can configure your
    application to see uncommitted reads, which means that one transaction can see data that
    has been modified but not yet committed by another transaction. Doing this might mean
    your transaction reads data "dirtied" by another transaction, but which subsequently might
    change before that other transaction commits its changes. On the other hand, lowering your
    isolation requirements means that your application can experience improved throughput due
    to reduced lock contention.
    For more information on concurrency, on managing isolation levels, and on deadlock
    detection, see Concurrency (page 32).

  • No. of users using same transaction

    hai iam shivaa.
    how can we find no. of users using same transaction at a given time on a given server.can i also know the order(time) in which the users started using the transaction?
    eg--no. of users using transation VA01 on a given server at a given time.
        --order in which users started using VAO1

    Hi Shiva,
    If you have got the appropriate solution, reward all useful answers & close the thread.
    Regards,
    Senthilkumar SD

  • Open Transaction MM01/MM02 with multiple views using  CALL TRANSACTION

    Hi All,
    I want to open MM01/MM02 with multiple views using call transaction but in the parameter ID for Views (MMX) I can pass status of only one View.
      SET PARAMETER ID 'MAT' FIELD v_mat.
      SET PARAMETER ID 'VKO' FIELD ' '.
      SET PARAMETER ID 'MTA' FIELD IT_MOFF-MTART.
      SET PARAMETER ID 'MTP' FIELD IT_MOFF-MBRSH.
      SET PARAMETER ID 'VTW' FIELD ' '.
      SET PARAMETER ID 'BWT' FIELD ' '.
      SET PARAMETER ID 'LGT' FIELD ' '.
      SET PARAMETER ID 'MXX' FIELD 'K'.     "Sales View
      SET PARAMETER ID 'MM5' FIELD ' '.
      CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN
    Please suggest.
    Regards,
    Divya

    I do not exactly understand what you mean, but what i already did:
    - I checked that the fields are from the same type.
    - KUNNR is initialized! I already had a look to the debugger, that's why i'm posting this in this forum.
    any more comments on this ?
    maybe i have to change anything in the z-transaction. Btw, this is what the parameter looks like in the transaction:
    SELECTION-SCREEN BEGIN OF BLOCK Debitoren WITH FRAME TITLE text-001.
      PARAMETERS pkunnr type kna1-kunnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK Debitoren.
    Edited by: Sven Delangle on Sep 3, 2010 2:42 PM

  • How to update software on multiple iPhones using same iTunes account?

    How to update software on multiple iPhones using same iTunes account?

    SeanB15 wrote:
    Here are more details on my situation which should help clarify things...
    I purchased three iPhone 4 models back when they first came out (for my family) that all share the same iTunes account for access to apps and music, but each phone/user still has his/her custom contact list, email accts, and select lists of apps and music from the one iTunes acct library.  The problem is (as I understand it) that I can only update the software on one of the three iPhones – the primary phone I used to setup the iTunes acct without wiping out the separate contact lists, etc. As it stands today... the first (primary) iPhone associated with the iTune acct has been updated with the latest software version 5.1.1 and sync'd up with all the apps, music, etc from the one iTune acct, while the other two iPhones are still running on the original software version 4.0.2 and are experiencing problems now. I was advised by AT&T back in January that it would be necessary to setup separate iTunes accts for the second and third iPhones in order to receive system updates and still be able to manage separate contact lists, etc. If I go this route, I assume we will lose all the apps on phones #2 and #3 that we have been "sharing"... correct? Since this AT&T advice was prior to iCloud coming out, would iCloud be a better solution or at least part of the solution? I really don't yet understand how iCloud works. Hopefully, one of you can help me??
    we have 2 iphone 4's synced to the same itunes account for apps and music since the day we bought them, but each has a different icloud acct. they have both been updated on the same itunes account with every update that has come out since we bought them in december of 2010. nothing on either phone has ever been lost or duplicated. having said all that, maybe i'm missing something here, but we have had no problems. we do have itunes setup to sync manually. i do believe i'm a piker compared to lawrence finch, but i'm just telling you what happens in my house. maybe check with apple? is there a store near you?

  • HT204053 How do you change apple id for icloud if phone is already set up. Need to give each phone in my account their own apple id for icloud so that we dont receive each others messages but can still all use same id for purchases.

    How do you change apple id for icloud if phone is already set up. Need to give each phone in my account their own apple id for icloud so that we dont receive each others messages but can still all use same id for purchases.

    Settings-icloud-scroll to the bottom, select delete, if you want to keep the content select keep, otherwise it'll remove it. Then once it is done add the account information for the account you want on that phone.  Your apple ID in settings-store will remain the same and each device can still purchase/use content from that account.

  • Can multiple threads share the same cursor in berkeley db java edition?

    We use berkeley db to store our path computation results. We now have two threads which need to retrieve records from database. Specifically, the first thread accesses the database from the very beginning and read a certain number of records. Then, the second thread needs to access the database and read the rest records starting from the position where the cursor stops in the first thread. But, now, I cannot let these two threads share the same cursor. So, I have to open the database separately in two threads and use individual cursor for each thread. This means I have to in the second thread let the cursor skip the first certain number of records and then read the rest records. However, in this way, it is a waste of time letting the second thread skip a certain of records. It will be ideal for us that the second thread can start reading the record just from the place where the first thread stops. Actually, I have tried using transactional cursor and wanted to let the two threads share the same transactional cursor. But it seems that this didn't work.
    Can anyone give any suggestion? Thank you so much!
    sgao

    If your question is really about using the BDB Java Edition product please post to the JE forum:
    Berkeley DB Java Edition
    If your question is about using the Java API of the BDB (C-based) product, then this is the correct forum.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can Multiple ipods use the same computer/itunes program

    I recently purchased two ipods for different family members. Can both be used on the same computer. I seem to remember seeing a blurb in the user agreement for itunes that said the program was only for one ipod. Can anyone elaborate?

    When the iPods belong to different people, there are basically three ways of using multiple iPods on a computer and these involve:
    a) Sharing a single iTunes library
    b) Creating Multiple Libraries in a single user account
    c) Creating multiple user accounts.
    Note: When you are sharing an iTunes library, you don't have to set each iPod to update in the same manner, you can mix and match from the options below as each iPod has it's own update settings
    Sharing a Library and/or User Account
    If you want to share the one library, you can set either or all of the iPods so that they only get updated with only certain playlists (you can update from more than one if you wish): Loading songs onto iPod automatically - Windows
    Choosing the update option "Sync Music - Selected playlists" allows you to create a playlist specifically for the iPod and drag the tracks you want into it. If you tire of the list and want to change it, you just add or remove the songs you don't want. The ones you take out out remain in the library to be used some other time if you choose. You can read more about playlists at these links:
    iTunes: Creating playlists of your favorite songs
    How to create a Smart Playlist with iTunes
    Or you can choose to update any or all of the iPods manually and just drag whatever content you want to them: Managing content manually on iPod
    Loading the iPod shuffle differs slightly but it can still be used with the others, for details have a look at this page: Loading songs onto iPod shuffle - Windows
    Multiple Libraries
    It's also possible to have multiple libraries in a single account. To create or access a second (or more) library, hold down the Option key (or Shift key in Windows) when launching iTunes 7. In the resulting dialogue you will get the option to create a new library or navigate to the other Library.
    Note: You can only have one Library open at a time and iTunes will default to the last library opened if you don't use the keyboard command to choose one. This can prove tricky when using multiple iPods, if you don't use the keyboard command you can risk syncing to the wrong library: Using multiple iTunes libraries -Windows
    *Separate User Accounts*
    Another option is to create a separate User account for each person on your PC or Mac. Different accounts by definition would give you completely separate libraries. Each account has it's own iTunes folder, Library and iTunes Music folder and you load it with CDs etc just as you did with your original one. The iPod can be set to update however the owner chooses, sync all, manual or sync specific playlists
    I don't use Windows so I can't give you a step by step on that one, however I can point you to another web page which should help you out. You can read about Windows user accounts here: Create A New User Account In Vista

  • How can I download eBooks to multiple iPads using same apple ID?

    How can I download eBooks to multiple iPads using the same apple ID?

    Those are called iBooks. On the devices go to iTunes app and then to the Purchased section in bottom row and find the media and tap install

  • How to proces the record in Table with multiple threads using Pl/Sql & Java

    I have a table containing millions of records in it; and numbers of records also keep on increasing because of a high speed process populating this table.
    I want to process this table using multiple threads of java. But the condition is that each records should process only once by any of the thread. And after processing I need to delete that record from the table.
    Here is what I am thinking. I will put the code to process the records in PL/SQL procedure and call it by multiple threads of Java to make the processing concurrent.
    Java Thread.1 }
    Java Thread.2 }
    .....................} -------------> PL/SQL Procedure to process and delete Records ------> <<<Table >>>
    Java Thread.n }
    But the problem is how can I restrict a record not to pick by another thread while processing(So it should not processed multiple times) ?
    I am very much familiar with PL/SQL code. Only issue I am facing is How to fetch/process/delete the record only once.
    I can change the structure of table to add any new column if needed.
    Thanks in advance.
    Edited by: abhisheak123 on Aug 2, 2009 11:29 PM

    Check if you can use the bucket logic in your PLSQL code..
    By bucket I mean if you can make multiple buckets of your data to be processed so that each bucket contains the different rows and then call the PLSQL process in parallel.
    Lets say there is a column create_date and processed_flag in your table.
    Your PLSQL code should take 2 parameters start_date and end_date.
    Now if you want to process data say between 01-Jan to 06-Jan, a wrapper program should first create 6 buckets each of one day and then call PLSQL proc in parallel for these 6 different buckets.
    Regards
    Arun

  • Multiple Threads Using System.out.println...

    i have a client server app and each client that connects to the server has its own thread.
    i am running the server on a pc using windows xp and to run it i just use a bat file which uses cmd.exe and my output using System.out.println prints out in the cmd.exe.
    each of my threads is using System.out.println to send debug info and outs quite often.
    after the screen fills a scroll bar appears at the right and you can scroll back to see past output.
    my app is all running ok but when i had a ton of output coming in all at once i tried to scroll back to see the older output and realized that if i click down on the scroll bar and fight the new input it freezes my server app. then when i release it it continues lol.
    it made me wonder if output from multiple threads when there are many all at once (say 20 or 30 threads all outputing at the exact same time) could cause a slow down or effect the performance of the server?
    i use a debug variable so i can just turn this output 100 % off except for critical errors so there would be no output but i am just curious as to whether or not it may be causing problems when its on.

    That's not a performance issue, I guess System.out.println() simply gets blocked by the console while you're scrolling and thus your app stalls, until you stop doing that.
    Maybe you should look into logging.

  • Can two computers use same iTunes library on a network drive?

    Can two computers use directly (rather than share) the same iTunes library on a network drive? 
    My media library is on a network drive attached to my Airport Extreme. Right now I share the library with my desktop Mac. I can share fine, but I would like to be able to add, delete, and make other changes in the media library from both computers. The two computers would not be accessing the library at the same time as I am the sole user of both.

    I appreciate your input and I think you're right about this being impossible. But just to clarify, you say I can't "have multiple machines accessing the same music files from a shared location." I can have multiple machines accessing the same music files from a shared location--I just can't have them accessing the same music files simultaneously--which may have been what you meant. For my situation, I think it will be less work to just quit iTunes on my server when I want to run it on my client (using Chicken of the VNC). It's not ideal, but it's less time-consuming than periodically syncing three computers.
    Again, thanks for the input.

  • Multiple users using same email account

    I'm the computer tech for a volunteer fire department. We have multiple officers using this computer and each one wants access to the same email account under their personal user accounts. Can this be done?

    You just need to "move" the profile to a common access location.
    http://kb.mozillazine.org/Moving_your_profile_folder_-_Thunderbird

  • Synchronize work from multiple threads using wait() and notifyAll() help

    Hello folks,
    (Sorry for my bad english)
    My current project handles multiple access requests to a shared collection from multiple threads originating from different classess and methods. Therefor I need to keep track of the order in which the Threads access that collection. I wrote a sort of Buffer class that has a static instance entry which initiate a new Instance of my Buffer class, attributes the instance a cue number and return the instance to the caller Thread.(Just like when you go to a supermarket and draw a number to wait to get served at the cheese counter).The callerThread then uses this instance to execute a method within the buffer class. Inside the buffer class method, I want to set a while loop on wait() just like this:
    while(currentCue != myCueState)
    wait();
    when all other prior method calls within my Buffer class are done, the loop should wake up using a notifyAll() call and check the condition "currentCue != myCueState" agen to see if its turn has come.
    I am new to the wait() and notifyAll() stuff and are therefor not sure what I am dooing wrong here: The only way this buffer class finishes all it's cues is when the caller Threads are beeing executed in the same order than they have checked in to the Buffer class. Otherwise I get some sort of dead-lock in the middle. Here is my code for the Buffer class:
    public class Buffer{
        private static int currentCue = 0;
        private static int lastCued = 0;
        private int myCueState;
        private Buffer myInstance = null;
        synchronized void doTaskOne(){      
            try{
                while(currentCue != myCueState)
                    wait();           
                //Do your task now
                System.out.println("doTaskOne got Executed: "+currentCue);
                currentCue++;
                notifyAll();
            catch(Exception a){}
        synchronized void doTaskTwo(){
             try{
                while(currentCue != myCueState)
                    wait();
                //Do your task now
                System.out.println("doTaskTwo got Executed: "+currentCue);
                currentCue++;
                notifyAll();
            catch(Exception a){}
        synchronized void doTaskThree(){
            try{
                while(currentCue != myCueState)
                    wait();          
                //Do your task now
                System.out.println("doTaskThree got Executed: "+currentCue);
                currentCue++; 
                notifyAll();
            catch(Exception a){}
        synchronized Object getSomething(){
            try{                   
                while(currentCue != myCueState)
                    wait();           
                //Do your task now
                System.out.println("getSomething got Executed");
                currentCue++;
                notifyAll();
            catch(Exception a){}
            return "something";
        //Access the buffer class through a single static synchronized instance and draw a turn number
        public synchronized Buffer instance(){
            myInstance = new Buffer();
            myInstance.setMyCueState();
            return myInstance;
        private void setMyCueState(){
             myCueState = lastCued;
             lastCued++;
    }and here for the Test class I have coded to test this:
    public class TestBuffer{
         private Buffer accessOne;
         private Buffer accessTwo;
         private Buffer accessThree;
         private Buffer accessFour;
         public TestBuffer(){
                    //Instantiate different instances from Bufferclass and draw a number
              accessThree = new Buffer().instance();
              accessOne = new Buffer().instance();
              accessTwo = new Buffer().instance();          
              accessFour = new Buffer().instance();
              Thread one = new Thread(){
                   public void run(){
                        accessOne.doTaskOne();
              Thread two = new Thread(){
                   public void run(){
                        accessTwo.doTaskTwo();
              Thread three = new Thread(){
                   public void run(){
                        accessThree.doTaskThree();
              Thread four = new Thread(){
                   public void run(){
                        accessFour.getSomething();
              try{               
                   one.start();                    
                   two.start();
                   three.start();     
                   four.start();                         
              catch(Exception f){}
         public static void main(String args[]){
              TestBuffer myTest = new TestBuffer();
    }What am I doing wrong here??
    Maby this is not how I should use the notifyAll() method, but how then?
    Please give me a solution!
    Thanks

    Ok, so if I get you guys right, the following should do it:
    public class Buffer{
        private static Object sharedLock = new Object();
        public void doTaskOne(){      
              synchronized(sharedLock)  {
                System.out.println("doTaskOne got Executed: ");
        public void doTaskTwo(){
             synchronized(sharedLock)  {
                System.out.println("doTaskTwo got Executed: ");
        public void doTaskThree(){
             synchronized(sharedLock)  {
                  System.out.println("doTaskThree got Executed: ");
        public Object getSomething(){
            synchronized(sharedLock)  {
                System.out.println("getSomething got Executed");
                return "something";
    }Lets say that each method accesses the same ressources (in this case a table model) to retreave values, delete rows and set some existing values vith new values and all this 20-30 times a minute, all processing will stay synchronised and collision is not possible?
    And lets say I would update the Table model directly from the buffer Class using MyTableModel.instance().setValueAt() or watever methods I implemented on my Table model, could I safely do that using "SwingUtilities.invokeLater();" from my BufferClass just like this:
    public void doTaskThree(){
            synchronized(sharedLock)  {
                   Runnable runme = new Runnable(){
                         public void run(){
                                MyTableModel.instance().setValueAt("abc", 5,5);  
                   SwingUtilities.invokeLater(runme);
    }Thanks in advance for your help guys!

Maybe you are looking for

  • File Adapter (FTP) Receiver modification check

    Hi All, In the sender adapter we can check advanced mode and then check the modification of the file to be picked up so we always take the full file. We have a scenario where XI writes a file in a server via FTP and a job is executed in that server t

  • Certification on SAP Netweaver 7.1 (CE)

    Hi, We are a little bit ahead of things, but is there already any idea about what the certification criteria for a J2EE deployment are going to be for SAP Netweaver 7.1? Is it going to be similar to 7.0 or are criteria drastically going to change in

  • Dynamically resizing a side bar

    I have a side bar that contains a list of events from Google's calendar. I want the div that contains the events to be resized so the events won't spill out of the element. The following code in widget1_markup.html does this. function adjustEventDIV(

  • Is it safer to disconnect from the internet (DSL) when not in use?

    I just got Verizon DSL service and I was wondering for security if it's safer to disconnnect from the internet (but keeping the router/modem on so that just the DSL LED is on) when I'm not using it to protect my computer from hackers and to protect t

  • BrTools Studio installation error

    Hello, I am trying to install BrTools Studio but throws me an error : INFO      2009/04/30 14:24:16   [Setup] SAP BR*Tools Studio Setup INFO      2009/04/30 14:24:16   [Setup] Version 7.10 (1) INFO      2009/04/30 14:24:16   [Setup] Initializing... I