16.3.2. Create a Thread Pool
EJB Thread pools can be created using the Management Console or the CLI.
Procedure 16.9. Create an EJB Thread Pool using the Management Console
- Login to the Management Console. Section 3.2.2, “Log in to the Management Console”
- Click on Profile in the top right, expand the Container item in the Profile panel on the left and select EJB 3. Then select the Thread Pools tab from the main panel.
Figure 16.6. EJB3 Thread Pools Panel
- Click the Add button. The Add EJB3 Thread Pools dialog appears.
- Specify the required details, Name, Max. Threads, and Keep-Alive Timeout value.
- Click on the Save button to save the new thread pool or click the Cancel link to abort the procedure.
- If you click the Save button, the dialog will close and the new thread pool will appear in the list.
- If you click Cancel, the dialog will close and no new thread pool will be created.
Procedure 16.10. Create a Thread Pool using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.3.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 16.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 16.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>