Thread Pools in application servers

Discussions

EJB design: Thread Pools in application servers

  1. Thread Pools in application servers (6 messages)

    Hi everyone,

    It seems to me that using a 'home-made' thread pool (with all the 'bells and whistles' of worker threads, time-out periods, dispaching, etc) in an application server can cause problems by hampering the thread pooling mechanism of the app server. This is my gut feeling, I didn't find anything written regarding this issue and I am basically gathering all the information I can to make my implementation decision. Any helpful suggestions, links, comments would be very appreciated.
    Can JMS be a viable alternative?

    Thanks a lot!

    Threaded Messages (6)

  2. Thread Pools in application servers[ Go to top ]

    The use of threads in EJB is strictly forbidden. In general you should never need threads and thread pools in EJB. You should design your application in such a way that the containers threads act like your own.

    Why do you have your own threads? What problem are you trying to solve?

    Dave Wolf
    Internet Applications Division
    Sybase

  3. Thread Pools in application servers[ Go to top ]

    Dave,

    Thank you for your reply. What I would like to do is to query periodically a queue of items and have worker threads dispatched to process one item in the queue. A dispatched worker thread will call session/entity beans. So, basically, my thread will call a bean. Is that wrong? I am not very familiar with the issue so I am looking for more info!
    Thanks a lot
    Serban
  4. Thread Pools in application servers[ Go to top ]

    Hi Serban,

    All you need to do is move your queue of items and the worker threads outside the EJB container, where there are no restrictions concerning threads. Then each of your worker threads is free to login to your EJB container and call session/entity beans to do their work.

    David Sims
    Sims Computing
  5. Thread Pools in application servers[ Go to top ]

    David,

    Thanks for the reply. So you basically mean that my thread pool should act like a client for the EJB container. Sounds OK to me! Thx

    Serban
    Click to see my contact info
  6. Thread Pools in application servers[ Go to top ]

    hi Serban, yes, exactly. Simply make your thread pool a client to your EJB container.

    David
  7. Thread Pools in application servers[ Go to top ]

    JMS is the right fix in the long run.

    Dave Wolf
    Internet Applications Division
    Sybase