Hi,
I have a ServletContextListener for Tomcat which pops serialized objects from a SQL "queue" and based on this object, must make several edits to 2 other db tables. I must be sure that if the serialized worker object is popped, the edits are made, or my whole database will become corrupted. Although this sounds like a transaction, I'm wondering if there is another way. You see, I'm worried about table deadlock (Hibernate session transactions).
Now, I send a message to the thread launched by the ServletContextListener on contextDestroyed, and that thread is designed to finish its last unit of work and return from run() method. The contextDestroyed for my one tomcat context listener joins the worker thread, which is guaranteed to finish after at most one db transaction.
My concern is that if I pop from db queue in one transaction, and do the work for it in another, tomcat could get impatient if being stopped, and thread death could abort the work corresponding to the db queue element just popped.
Andy