Topic
2 replies Latest Post - ‏2011-02-21T17:03:52Z by SystemAdmin
SystemAdmin
SystemAdmin
4447 Posts
ACCEPTED ANSWER

Pinned topic Starting custom threads in Websphere Servlet Container

‏2010-12-27T10:17:20Z |
Hello,

The web application I develop creates many threads in a "StartupServlet"'s init method and destroys them in the destroy method.

The threads work in an infinite loop unless they are signaled to stop. They have to create a lot of list objects, that is, they produce a lot of garbage object (objects left for the GC).

The reason, I create them within a servlet environment is because they need to invoke remote ejbs. I pass them an InitialContext object prepared within the servlet environment. (and invoking remote EJBs in a standalone application can be quite cumbersome.)

The threads are marked as daemon threads, so that they don't hinder the WAS process (main process) from shutting down.

My questions are :
1) Websphere runs on the IBM JVM. What are the odds that the IBM JVM's GC doesn't collect garbage objects created by my custom threads ?
2) Are there any other drawbacks in creating custom threads within a servlet environment ?
Updated on 2011-02-21T17:03:52Z at 2011-02-21T17:03:52Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    4447 Posts
    ACCEPTED ANSWER

    Re: Starting custom threads in Websphere Servlet Container

    ‏2011-02-16T18:37:53Z  in response to SystemAdmin
    Hello,
    Just FYI, you might want to look at Asynchronous beans at http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.nd.doc/info/ae/asyncbns/concepts/casb_asbover.html as a way of running multiple threads within WebSphere Application Server.

    Thanks,
    David Yang
    Lotus Web Content Management support

    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • SystemAdmin
      SystemAdmin
      4447 Posts
      ACCEPTED ANSWER

      Re: Starting custom threads in Websphere Servlet Container

      ‏2011-02-21T17:03:52Z  in response to SystemAdmin
      Thanks for the tip.

      I had a conversation here : http://www.coderanch.com/t/521650/Websphere/Starting-custom-threads-Websphere-Servlet

      This question is kind of answered.