12.2. Direct Use of the StateManager Class
The examples throughout this manual derive user classes from the
LockManager
class. There are two reasons for this.
- Most importantly, the serializability constraints of atomic actions require it.
- It reduces the need for programmer intervention.
However, if you only require access to the persistence and recovery mechanisms of JBoss Transaction Service, you can directly derive a user class from
StateManager
.
Classes derived directly from
StateManager
must make use of its state management mechanisms explicitly, rather than relying on LockManager
. You need to make appropriate use of the activate
, deactivate
, and modified
methods, since the constructors of StateManager
are effectively identical to those of LockManager
.
12.2.1. The activate
Method
boolean activate () boolean activate (String storeRoot)
The
activate
method loads an object from the object store. The object’s UID needs to already be set via the constructor, and the object must exist in the store. If the object is successfully read, the restore_state
method is called to build the object in memory. The activate
method operates such that once an object has been activated, further calls are ignored. The parameter represents the root name of the object store to search for the object. If the value is null, the default store is used.