I am writing a Servlet to process transactions from mobile devices, and was wondering if it is necessary that I create and run the Transaction component on a separate thread from the Servlet thread to prevent the Servlet from being tied up for the whole transaction.
Any help appreciated. I am looking for some info on the web and also have some books to go through, but I was just lazy as all developers are and thought to ask first.
I'm no expert, not even a junior developer. All I can say is that it looks like you already have the answer to your question. To be safe, maybe do what you posted " run the Transaction component on a separate thread from the Servlet thread to prevent the Servlet from being tied up for the whole transaction".
if you are writing jee you should not be threading at all.
servlets are static and served out of a pool (of threads) so you should be ok. if you want more capacity you add more execute threads to handle incoming requests.