16.4.2. Set Default Session Bean Access Timeout Values

JBoss Administrators can specify the default timeout values for Singleton and Stateful session beans. The default timeout values can be changed using the Management Console or the CLI. The default value is 5000 milliseconds.

Procedure 16.15. Set Default Session Bean Access Timeout Values using the Management Console

  1. Login to the Management Console. See Section 3.2.2, “Log in to the Management Console”.
  2. 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 Container tab from the main panel.
    EJB3 Container Configuration panel in the Management Console (Standalone Server)

    Figure 16.9. EJB3 Container Configuration panel in the Management Console (Standalone Server)

  3. Click the Edit button. The fields in the Details area are now editable.
  4. Enter the required values in the Stateful Access Timeout and/or Singleton Access Timeout text boxes.
  5. Click the Save button to keep the changes, or click the Cancel link to discard them.
  6. The Details area will now be non-editable and display the correct timeout values.

Procedure 16.16. Set Session Bean Access Timeout Values Using the CLI

  1. 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”.
  2. Use the write-attribute operation with the following syntax.
    /subsystem=ejb3:write-attribute(name="BEANTYPE", value=TIME)
    • Replace BEANTYPE with default-stateful-bean-access-timeout for Stateful Session Beans, or default-singleton-bean-access-timeout for Singleton Session Beans.
    • Replace TIME with the required timeout value.
  3. Use the read-resource operation to confirm the changes.
    /subsystem=ejb3:read-resource

Example 16.12. Setting the Default Stateful Bean Access Timeout value to 9000 with the CLI

[standalone@localhost:9999 /] /subsystem=ejb3:write-attribute(name="default-stateful-bean-access-timeout", value=9000)  
{"outcome" => "success"}
[standalone@localhost:9999 /]

Example 16.13. XML Configuration Sample

<subsystem xmlns="urn:jboss:domain:ejb3:1.2">
   <session-bean>
      <stateless>
         <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
      </stateless>
      <stateful default-access-timeout="5000" cache-ref="simple"/>
      <singleton default-access-timeout="5000"/>
   </session-bean>
   
</subsystem>