Ability to configure default global stateful timeout for Stateful Session Beans
Overview
Issue Metadata
Issue
-
https://issues.redhat.com/browse/WFLY-12680 (Ability to configure default global stateful timeout for Stateful Session Beans)
Related Issues
-
https://issues.redhat.com/browse/EAP7-1243 (Ability to configure default global stateful timeout for Stateful Session Beans)
Dev Contacts
QE Contacts
Testing By
[x] Engineering
[x] QE
Affected Projects or Components
-
ejb3
Other Interested Projects
Requirements
The standard way to configure stateful bean session timeout for each ejb is via @StatefulTimeout annotation,
or stateful-timeout in ejb-jar.xml. But WildFly currently (version 18) lacks the ability to configure a default
global stateful bean session timeout for all deployed stateful beans. This feature is useful to deploy and
configure multiple stateful beans consistently in a server instance or cluster.
Hard Requirements
-
Users should be able to configure default global stateful timeout in server config file for all deployed stateful session beans.
-
If this configuration is absent, the current behavior should be preserved (i.e., stateful session beans do not timeout unless explicitly removed by application)
-
add this configuration via CLI
-
remove this configuration via CLI
-
update this configuration to a new value via CLI
-
read this configuration value via CLI
-
-
@StatefulTimeoutannotation in bean class should override this default global stateful timeout in server config file -
stateful-timeoutin ejb-jar.xml should override this default global stateful timeout in server config file -
when neither
@StatefulTimeoutnorstateful-timeoutis present, the configureddefault-stateful-bean-session-timeoutshould take effect.
Expected CLI Operations and resources
[standalone@localhost:9990 /] /subsystem=ejb3:read-attribute(name=default-stateful-bean-session-timeout)
{
"outcome" => "success",
"result" => -1
}
[standalone@localhost:9990 /] /subsystem=ejb3:write-attribute(name=default-stateful-bean-session-timeout, value=6000)
{"outcome" => "success"}
Nice-to-Have Requirements
-
None
Non-Requirements
-
ability to configure default global stateful timeout in WildFly admin console
-
ability to specify default global stateful timeout in custom time unit
-
ability to immediately apply the updated default global stateful timeout value to deployed stateful beans
Implementation Plan
-
add a new attribute,
default-session-timeoutto ejb3 subsystem schema, for example,
<xs:complexType name="stateful-beanType">
...
<xs:attribute name="default-session-timeout" type="xs:integer" default="-1" use="optional">
<xs:annotation>
<xs:documentation>
The default session timeout, for stateful session beans, in milliseconds
</xs:documentation>
</xs:annotation>
</xs:attribute>
<subsystem xmlns="urn:jboss:domain:ejb3:7.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<!-- add new attribute default-session-timeout -->
<stateful default-session-timeout="600000"
default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
...
</session-bean>
-
This new configuration will appear as a new attribute (
default-stateful-bean-session-timeout) under ejb3 subsystem resource:
[standalone@localhost:9990 /] /subsystem=ejb3:read-resource
{
"outcome" => "success",
"result" => {
...
"default-stateful-bean-session-timeout" => -1,
...
}
Test Plan
New tests will be added to wildfly/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/stateful/timeout,
and existing test case in that directory will be enhanced to verify the new feature.
-
structural tests with CLI CRUD operations of the new attribute
default-stateful-bean-session-timeout-
write attribute
default-stateful-bean-session-timeoutto-1,0, and1000, and then read and verify the attribute value -
rewrite the attribute to some other value, and then read and verify the updated attribute value
-
-
behavioral tests of default stateful session timeout
-
when this attribute is absent in server config file, a stateful session bean should not timeout and be removed. This is the existing behavior before this RFE is implemented.
-
when this attribute is set to a certain value, a stateful session bean should timeout and subject to removal after this duration (there could be some delay between timeout and actual removal)
-
@StatefulTimeoutannotation in bean class should override this attribute in server config file -
stateful-timeoutinejb-jar.xmlshould override this attribute in server config file
-
-
transformer tests should be added to
Ejb3TransformersTestCase
Community Documentation
Enhance WildFly community docs (docs/src/main/asciidoc/_admin-guide/subsystem-configuration/EJB3.adoc) to describe
the new attribute default-stateful-bean-session-timeout and affected changes.