Create Two Thread Pools for Asynchronous session bean methods in JBoss EAP6?
Asked Answered
H

1

7

In my application I use @Asynchronous business methods on session beans in two different places. Each has its own logic and requirements so ideally I'd like to configure a maximum thread pool size for each. It looks like JBoss EAP 6.2.2 EAP only allows one asynchronous thread pool.

Is there a way to create two, or do I just have to create a single pool that will have enough for both (and lose the ability to limit either)?

Hermann answered 12/11, 2014 at 14:18 Comment(0)
S
5

I would expect that you have already looked at documentation on https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.2/pdf/Administration_and_Configuration_Guide/JBoss_Enterprise_Application_Platform-6.2-Administration_and_Configuration_Guide-en-US.pdf

Extract from docs

20.3. Configuring EJB Thread Pools 20.3.1. Enterprise Bean Thread Pools

JBoss EAP 6 maintains number of instances of Java thread objects in memory for use by enterprise bean services, including remote invocation, the timer service, and asynchronous invocation.

This technique is called thread pooling. It provides improved performance by eliminating the overhead of thread creation and gives the system administrator a mechanism for controlling resource usage.

Multiple thread pools can be created with different parameters and each service can be allocated a different thread pool.

The above extract would seem to suggest that the following will provide 2 thread pools named first and second.

<thread-pools>
   <thread-pool name="first" max-threads="20" keepalive-time="150"/>
   <thread-pool name="second" max-threads="20" keepalive-time="150"/>
</thread-pools>
Sulfonate answered 18/11, 2015 at 11:59 Comment(1)
how to assign specific pool to specific EJB? I guess by name but not sure how.. Let's say I have 3 EJBs I want to use 'first' and the rest to use 'second'. Maybe with @Pool("first")? Thanks for the explanation and exampleReincarnate

© 2022 - 2024 — McMap. All rights reserved.