23.3.2. Create a Thread Pool
EJB Thread pools can be created using the Management Console or the CLI.
Procedure 23.9. Create an EJB Thread Pool using the Management Console
- Login to the Management Console. Section 3.4.2, “Log in to the Management Console”
- Click on the Configuration tab at the top of the screen. Expand the Container menu and select EJB 3. Select the Thread Pools tab.
- Click Add. The Add EJB3 Thread Pools dialog appears.
- Specify the required details, Name, Max. Threads, and Keep-Alive Timeout value.
- Click Save to finish.
Procedure 23.10. Create a Thread Pool using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.5.4, “Connect to a Managed Server Instance Using the Management CLI”.
- Use the
add
operation with the following syntax./subsystem=ejb3/thread-pool=THREADPOOLNAME:add(max-threads=MAXSIZE, keepalive-time={"time"=>"TIME", "unit"=>UNIT"})
- Replace THREADPOOLNAME with the required name for the thread pool.
- Replace MAXSIZE with the maximum size of the thread pool.
- Replace UNIT with the required time unit to be used for the required keep-alive time. Allowed values are:
NANOSECONDS
,MICROSECONDS
,MILLISECONDS
,SECONDS
,MINUTES
,HOURS
, andDAYS
. - Replace TIME with the integer value of the required keep-alive time. This value is a number of UNITs.
- Use the
read-resource
operation to confirm the creation of the bean pool./subsystem=ejb3/strict-max-bean-instance-pool=THREADPOOLNAME:read-resource
Example 23.7. Create a Thread Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=testmepool:add(max-threads=50, keepalive-time={"time"=>"150", "unit"=>"SECONDS"}) {"outcome" => "success"} [standalone@localhost:9999 /]
Example 23.8. XML Configuration Sample
<subsystem xmlns="urn:jboss:domain:ejb3:1.2"> <thread-pools> <thread-pool name="default" max-threads="20" keepalive-time="150"/> </thread-pools> </subsystem>