0 Replies Latest reply on Mar 4, 2009 11:26 AM by Mark Candelora

    Design problem: EJB containers prevent threadpool allocation

    Mark Candelora Newbie

      I have a design issue I'm working through - I'm attempting to limit requests into a remote system to a set number per client. So for each client we have, I want a max of (for example) 15 requests to be sent to the system. Clients are added and removed constantly so extra development for each client is out of the question.

      In normal Java I would just create a new client object that allocates a thread pool and send requests into each client. The thread pool would limit the number of active requests in the system and all is well. However, this logic will not work in EJB land because the container does not like application code allocating thread pools.

      The only other way I can think of to implement anything like this would be to submit jobs to a queue and have an MDB pull off the queue with a fixed pool size. But this solution would not allow for dynamically increasing the number of clients (we would need to allocate a new pool for each client).

      So, is there a way to create & limit asynchronous processes using JBoss/EJB's?