Implementing transactions across threads without using J2EE


XML & Web services: Implementing transactions across threads without using J2EE

  1. I have a requirement wherein I can't use application server or a TP monitor or any other s/w that enables nested transaction .

    1. Multiple threads are doing some processing. Each thread should be able to do its portion.

    2. Finally after all the threads are done I should do a final commit.

    1. A controller creats a connection object and creats prepared statements for each thread and passes it to respective threads. I am not doing any commit in each thread, just executing queries.

    2. Maintain a hashmap that keeps track of status of each thread and once all threads are done successfully, finally call commit on the connection object.

    1. Since each thread is using the same underlying connection so this will be slow.

    2. JDBC limits me in the way I can implement transaction and it doesn't support nested transactions.

    Any ideas or better solutions???
  2. I replied to this in another forum. Please search for yourself, and note that it is not useful to post the same question in multiple forums.

  3. Thanks, actually I posted it on this thread and realized that it was the wrong thread to post to but I didn't know how it remove it from here.