此内容没有您所选择的语言版本。
21.2. Configuring Bean Pools
21.2.1. Bean Pools 复制链接链接已复制到粘贴板!
@org.jboss.ejb3.annotation.Pool
annotation can be used on EJBs to identify the pool, which has to be used for that EJB. This annotation points to the name of that pool.
21.2.2. Create a Bean Pool 复制链接链接已复制到粘贴板!
Procedure 21.1. Create a bean pool using the Management Console
- Login to the Management Console. Refer to 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.
- Click Add EJB3 Bean Pools dialog appears.. The
- Specify the required details, Name, Max Pool Size, Timeout value, and Timeout unit.
- Clickbutton to finish.
Procedure 21.2. Create a bean 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./subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:add(max-pool-size=MAXSIZE, timeout=TIMEOUT, timeout-unit="UNIT")
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:add(max-pool-size=MAXSIZE, timeout=TIMEOUT, timeout-unit="UNIT")
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace BEANPOOLNAME with the required name for the bean pool.
- Replace MAXSIZE with the maximum size of the bean pool.
- Replace TIMEOUT
- Replace UNIT with the required time unit. Allowed values are:
NANOSECONDS
,MICROSECONDS
,MILLISECONDS
,SECONDS
,MINUTES
,HOURS
, andDAYS
.
- Use the
read-resource
operation to confirm the creation of the bean pool./subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:read-resource
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:read-resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 21.1. Create a Bean Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=ACCTS_BEAN_POOL:add(max-pool-size=500, timeout=5000, timeout-unit="SECONDS") {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=ACCTS_BEAN_POOL:add(max-pool-size=500, timeout=5000, timeout-unit="SECONDS")
{"outcome" => "success"}
Example 21.2. XML Configuration Sample
21.2.3. Remove a Bean Pool 复制链接链接已复制到粘贴板!
Prerequisites:
- The bean pool that you want to remove cannot be in use. Refer to Section 21.2.5, “Assign Bean Pools for Session and Message-Driven Beans” to ensure that it is not being used.
Procedure 21.3. Remove a bean pool using the Management Console
- Login to the Management Console. Refer to 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 bean pool to remove in the list.
- Click Remove Item dialog appears.. The
- Clickto confirm.
Procedure 21.4. Remove a bean 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./subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:remove
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:remove
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace BEANPOOLNAME with the required name for the bean pool.
Example 21.3. Removing a Bean Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=ACCTS_BEAN_POOL:remove {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=ACCTS_BEAN_POOL:remove
{"outcome" => "success"}
21.2.4. Edit a Bean Pool 复制链接链接已复制到粘贴板!
Procedure 21.5. Edit a bean 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 bean pool you want to edit.
- Click.
- Edit the details you want to change. Only Max Pool Size, Timeout value, and Timeout Unit can be changed.
- Clickto finish.
Procedure 21.6. Edit a bean 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 bean pool to be changed./subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:write-attribute(name="ATTRIBUTE", value="VALUE")
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:write-attribute(name="ATTRIBUTE", value="VALUE")
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace BEANPOOLNAME with the required name for the bean pool.
- Replace ATTRIBUTE with the name of the attribute to be edited. The attributes that can be edited in this way are
max-pool-size
,timeout
, andtimeout-unit
. - Replace VALUE with the required value of the attribute.
- Use the
read-resource
operation to confirm the changes to the bean pool./subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:read-resource
/subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:read-resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 21.4. Set the Timeout Value of a Bean Pool using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=HSBeanPool:write-attribute(name="timeout", value="1500") {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=HSBeanPool:write-attribute(name="timeout", value="1500")
{"outcome" => "success"}
slsb-strict-max-pool
and mdb-strict-max-pool
for stateless session beans and message-driven beans respectively.
@Pool
annotation can be used on EJBs to identify the pool to be used for that EJB.
Note
@Pool
annotation on a particular EJB will override any default settings specified using the management interfaces.
Procedure 21.7. Assign Bean Pools for Session and Message-Driven Beans 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.
- Click.
- Select the bean pool to use for each type of bean from the appropriate combo-box.
- Clickto finish.
Procedure 21.8. Assign Bean Pools for Session and Message-Driven Beans 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./subsystem=ejb3:write-attribute(name="BEANTYPE", value="BEANPOOL")
/subsystem=ejb3:write-attribute(name="BEANTYPE", value="BEANPOOL")
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace BEANTYPE with
default-mdb-instance-pool
for Message-Driven Beans ordefault-slsb-instance-pool
for stateless session beans. - Replace BEANPOOL with the name of the bean pool to assign.
- Use the
read-resource
operation to confirm the changes./subsystem=ejb3:read-resource
/subsystem=ejb3:read-resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 21.5. Assign a Bean Pool for Session Beans using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3:write-attribute(name="default-slsb-instance-pool", value="LV_SLSB_POOL") {"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=ejb3:write-attribute(name="default-slsb-instance-pool", value="LV_SLSB_POOL")
{"outcome" => "success"}
Example 21.6. XML Configuration Sample
Procedure 21.9. Assign a Bean Pool for a Session or Message-Driven Bean using the @Pool
annotation
- Add the
@Pool
annotation to the bean and specify the name of the bean pool to be used.This will override any default settings created in the management interfaces.@Stateless @Pool("slsb-strict-max-pool") public class HelloBean implements HelloBeanRemote {
@Stateless @Pool("slsb-strict-max-pool") public class HelloBean implements HelloBeanRemote {
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The
@org.jboss.ejb3.annotation.Pool
annotation is part of the JBoss EJB3 External API and must be added as a dependency. If you are using Maven, the following dependency should be added to yourpom.xml
file:<dependency> <groupId>org.jboss.ejb3</groupId> <artifactId>jboss-ejb3-ext-api</artifactId> <version>2.1.0</version> </dependency>
<dependency> <groupId>org.jboss.ejb3</groupId> <artifactId>jboss-ejb3-ext-api</artifactId> <version>2.1.0</version> </dependency>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow