21.3. Configuring EJB Thread Pools
21.3.1. Enterprise Bean Thread Pools
21.3.2. Create a Thread Pool
Procedure 21.10. Create an EJB Thread Pool using the Management Console
- Login to the Management Console. Section 3.3.2, “Log in to the Management Console”
- Click on thetab at the top of the screen.
- Expand themenu and select .
- Select thetab and click .
- Specify the Name and Max Threads values.
- Clickto finish.
Procedure 21.11. Create a Thread Pool using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.4.4, “Connect to a Managed Server Instance Using the Management CLI”.
- Use the
add
operation with the following syntax.Copy to Clipboard Copied! Toggle word wrap Toggle overflow /subsystem=ejb3/thread-pool=THREAD_POOL_NAME:add(max-threads=MAX_SIZE)
/subsystem=ejb3/thread-pool=THREAD_POOL_NAME:add(max-threads=MAX_SIZE)
- Replace THREAD_POOL_NAME with the name of the thread pool.
- Replace MAX_SIZE with the maximum size of the thread pool.
- Use the
read-resource
operation to confirm the creation of the bean pool.Copy to Clipboard Copied! Toggle word wrap Toggle overflow /subsystem=ejb3/thread-pool=THREAD_POOL_NAME:read-resource
/subsystem=ejb3/thread-pool=THREAD_POOL_NAME:read-resource
Example 21.7. Create a Thread Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=my-test-pool:add(max-threads=20) {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=my-test-pool:add(max-threads=20)
{"outcome" => "success"}
Example 21.8. XML Configuration Sample
<subsystem xmlns="urn:jboss:domain:ejb3:1.5"> ... <thread-pools> ... <thread-pool name="my-test-pool" max-threads="20"/> </thread-pools> ... </subsystem>
<subsystem xmlns="urn:jboss:domain:ejb3:1.5">
...
<thread-pools>
...
<thread-pool name="my-test-pool" max-threads="20"/>
</thread-pools>
...
</subsystem>
21.3.3. Remove a Thread Pool
Prerequisites
- The thread pool that you want to remove cannot be in use. Refer to the following tasks to ensure that the thread pool is not in use:
Procedure 21.12. Remove an EJB thread pool using the Management Console
- Login to the Management Console. Section 3.3.2, “Log in to the Management Console”.
- Click on thetab at the top of the screen. Expand the menu and select . Select the tab.
- Select the thread pool to you want to remove.
- Click Remove Item dialog appears.. The
- Click.
Procedure 21.13. Remove a thread pool using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.4.4, “Connect to a Managed Server Instance Using the Management CLI”.
- Use the
remove
operation with the following syntax.Copy to Clipboard Copied! Toggle word wrap Toggle overflow /subsystem=ejb3/thread-pool=THREADPOOLNAME:remove
/subsystem=ejb3/thread-pool=THREADPOOLNAME:remove
- Replace THREADPOOLNAME with the name of the thread pool.
Example 21.9. Removing a Thread Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=ACCTS_THREADS:remove {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=ACCTS_THREADS:remove
{"outcome" => "success"}
21.3.4. Edit a Thread Pool
Procedure 21.14. Edit a Thread Pool using the Management Console
- Login to the Management Console. Section 3.3.2, “Log in to the Management Console”.
- Click on thetab at the top of the screen. Expand the menu and select . Select the tab.
- Select the thread pool you want to edit.
- Click.
- Edit the details you want to change. Only the
Thread Factory
,Max Threads
,Keepalive Timeout
, andKeepalive Timeout Unit
values can be edited. - Clickto finish.
Procedure 21.15. Edit a thread pool using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.4.4, “Connect to a Managed Server Instance Using the Management CLI”.
- Use the
write_attribute
operation with the following syntax for each attribute of the thread pool to be changed.Copy to Clipboard Copied! Toggle word wrap Toggle overflow /subsystem=ejb3/thread-pool=THREADPOOLNAME:write-attribute(name="ATTRIBUTE", value="VALUE")
/subsystem=ejb3/thread-pool=THREADPOOLNAME:write-attribute(name="ATTRIBUTE", value="VALUE")
- Replace THREADPOOLNAME with the name of the thread pool.
- Replace ATTRIBUTE with the name of the attribute to be edited. The attributes that can be edited in this way are
keepalive-time
,max-threads
, andthread-factory
. - Replace VALUE with the required value of the attribute.
- Use the
read-resource
operation to confirm the changes to the thread pool.Copy to Clipboard Copied! Toggle word wrap Toggle overflow /subsystem=ejb3/thread-pool=THREADPOOLNAME:read-resource
/subsystem=ejb3/thread-pool=THREADPOOLNAME:read-resource
Important
keepalive-time
attribute with the CLI the required value is an object representation. It has the following syntax.
/subsystem=ejb3/thread-pool=THREADPOOLNAME:write-attribute(name="keepalive-time", value={"time" => "VALUE","unit" => "UNIT"}
/subsystem=ejb3/thread-pool=THREADPOOLNAME:write-attribute(name="keepalive-time", value={"time" => "VALUE","unit" => "UNIT"}
Example 21.10. Set the Maxsize Value of a Thread Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=HSThreads:write-attribute(name="max-threads", value="50") {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=HSThreads:write-attribute(name="max-threads", value="50")
{"outcome" => "success"}
Example 21.11. Set the keepalive-time
Time Value of a Thread Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=HSThreads:write-attribute(name="keepalive-time", value={"time"=>"150"}) {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=HSThreads:write-attribute(name="keepalive-time", value={"time"=>"150"})
{"outcome" => "success"}