I am using websphere server. I have a servlet which acts as a request processor. Since the request is for (a lot of) background processing, I need to simply create a thread which will do all these background jobs. In the mean time my request processor should return after starting this thread. What I find from looking at the log is as soon as my request processor returns, the background processing thread also seems to exit as it is not giving any log messages. I tried to make background thread a daemon one, but again it is not leaving any log messages. Doesn't the request processor thread which is started by websphere remain alive in the pool of threads for ever? In that case shouldn't my background thread keep on working? Even if the request processor dies, isn't it that given that background thread is a daemon thread, it should keep executing? Please clarify. If there is any flaw in my understanding of how websphere is managing its threads. Please help me understand it.
EDIT:Problem has been solved.Actually it was my bad.I was holding back the HttpServletRequest object to work in with in the background thread.But anyhow it was being destroyed once the request has returned from the servlet.So there was some null pointer exception in my background thread and it was exiting.I still have to make out the life cycle of HttpServletRequest object and when exactly it is destroyed.If you can help me understand this,I will be thankful. Thanks anyway!
EDIT: Adding what Servlets specification has to say on this: Each request object is valid only within the scope of a servlet’s service method, or within the scope of a filter’s doFilter method, unless the asynchronous processing is enabled for the component and the startAsync method is invoked on the request object. In the case where asynchronous processing occurs, the request object remains valid until complete is invoked on the AsyncContext. Containers commonly recycle request objects in order to avoid the performance overhead of request object creation. The developer must be aware that maintaining references to request objects for which startAsync has not been called outside the scope described above is not recommended as it may have indeterminate results.