このコンテンツは選択した言語では利用できません。
10.3.4. Object construction and destruction
JBoss Transaction Service objects can be either recoverable, persistent, both, or neither. Also, each object has a unique internal name. These attributes can only be set when that object is constructed. Therefore,
LockManager provides two protected constructors for use by derived classes, each of which fulfils a distinct purpose:
LockManager ()- Allows the creation of new objects, which have no prior state.
LockManager(intObjectType, ObjectNameattr)- Allows the creation of new objects, which have no prior state. The
ObjectTypeparameter denotes whether an object isrecoverable, recoverable and persistent (indicated byANDPERSISTENT) or neither (NEITHER). If an object is marked as being persistent, its state is stored in one of the object stores. Thesharedparameter only has meaning if the object isRECOVERABLE.; Ifattris not null and the object model isSINGLE(the default behavior), then the recoverable state of the object is maintained within the object itself. Otherwise, the state of the object is stored in an in-memory object store between atomic actions.Constructors for new persistent objects should make use of atomic actions within themselves. This will ensure that the state of the object is automatically written to the object store either when the action in the constructor commits, or, if an enclosing action exists, when the appropriate top-level action commits. LockManager(UidobjUid)- Allows access to the existing persistent object named in the
objUidparameter. The object's prior state, which is identified by the value of theobjUidparameter), is loaded from an object store automatically. LockManager(UidobjUid, ObjectNameattr)- Allows access to the existing persistent object named in the
objUidparameter. The object's prior state, which is identified by the value of theobjUid, is loaded from an object store automatically. If theattrparameter is not null, and the object model isSINGLE(the default behaviour), then the object is not reactivated at the start of each top-level transaction.
The destructor of a programmer-defined class needs to invoke the inherited operation
terminate, to inform the state management mechanism that the object is about to be destroyed. Otherwise, unpredictable results may occur.
Because the
LockManager class inherits from StateManager, it passes any supplied ObjectName instances to the StateManager class. As such, you can set the StateManager object model as described earlier.