<Container id="myStatefulContainer" type="STATEFUL">
accessTimeout = 30 seconds
bulkPassivate = 100
cache = org.apache.openejb.core.stateful.SimpleCache
capacity = 1000
frequency = 60
passivator = org.apache.openejb.core.stateful.SimplePassivater
timeOut = 20
</Container>
StatefulContainer Configuration
A StatefulContainer can be declared via xml in the
<tomee-home>/conf/tomee.xml
file or in a WEB-INF/resources.xml
file
using a declaration like the following. All properties in the element
body are optional.
Alternatively, a StatefulContainer can be declared via properties in the
<tomee-home>/conf/system.properties
file or via Java VirtualMachine
-D
properties. The properties can also be used when embedding TomEE
via the javax.ejb.embeddable.EJBContainer
API or InitialContext
myStatefulContainer = new://Container?type=STATEFUL
myStatefulContainer.accessTimeout = 30 seconds
myStatefulContainer.bulkPassivate = 100
myStatefulContainer.cache = org.apache.openejb.core.stateful.SimpleCache
myStatefulContainer.capacity = 1000
myStatefulContainer.frequency = 60
myStatefulContainer.passivator = org.apache.openejb.core.stateful.SimplePassivater
myStatefulContainer.timeOut = 20
Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for $\{} style variable substitution. Properties are not case sensitive. If a property is specified that is not supported by the declared StatefulContainer a warning will be logged. If a StatefulContainer is needed by the application and one is not declared, TomEE will create one dynamically using default settings. Multiple StatefulContainer declarations are allowed. # Supported Properties
Property
Type
Default
Description
accessTimeout
time
30 seconds
Specifies the maximum time an invocation could wait for the @Stateful
bean instance to become available before giving up.
bulkPassivate
int
100
Property name that specifies the number of instances to passivate at one time when doing bulk passivation.
cache
String
org.apache.openejb.core.stateful.SimpleCache
The cache is responsible for managing stateful bean instances. The cache can page instances to disk as memory is filled and can destroy abandoned instances. A different cache implementation can be used by setting this property to the fully qualified class name of the Cache implementation.
capacity
int
1000
Specifies the size of the bean pools for this stateful SessionBean container.
frequency
int
60
Specifies the frequency (in seconds) at which the bean cache is checked for idle beans.
passivator
String
org.apache.openejb.core.stateful.SimplePassivater
The passivator is responsible for writing beans to disk at passivation
time. Different passivators can be used by setting this property to the
fully qualified class name of the PassivationStrategy
implementation.
The passivator is not responsible for invoking any callbacks or other
processing, its only responsibly is to write the bean state to disk.
timeOut
time
20
Specifies the time a bean can be idle before it is removed by the container.
accessTimeout
Specifies the maximum time an invocation could wait for the @Stateful
bean instance to become available before giving up.
After the timeout is reached a
javax.ejb.ConcurrentAccessTimeoutException
will be thrown.
Usable time units: nanoseconds, microsecons, milliseconds, seconds, minutes, hours, days. Or any combination such as "1 hour and 27 minutes and 10 seconds"
Any usage of the javax.ejb.AccessTimeout
annotation will override this
setting for the bean or method where the annotation is used.
passivator
The passivator is responsible for writing beans to disk at passivation
time. Different passivators can be used by setting this property to the
fully qualified class name of the PassivationStrategy
implementation.
The passivator is not responsible for invoking any callbacks or other
processing, its only responsibly is to write the bean state to disk.
Known implementations:
-
org.apache.openejb.core.stateful.RAFPassivater
-
org.apache.openejb.core.stateful.SimplePassivater
timeOut
Specifies the time a bean can be idle before it is removed by the container.
This value is measured in minutes. A value of 5 would result in a time-out of 5 minutes between invocations. A value of -1 would mean no timeout. A value of 0 would mean a bean can be immediately removed by the container.
Any usage of the javax.ejb.StatefulTimeout
annotation will override
this setting for the bean where the annotation is used.