Show Table of Contents
10.2.5. JBoss Transaction Service Method Reference
The JBoss Transaction Service class
StateManagermanages the state of objects and provides all of the basic support mechanisms required for recovery, persistence, or both. Some operations must be defined by you. These operations are:
- Invoked to save the state of an object for future use, for recovery or persistence. The
ObjectTypeparameter indicates the reason for invocation. This allows you to save different pieces of information into the
OutputObjectStatesupplied as the first parameter, depending on whether recovery or persistence is desired. For example, pointers to other JBoss Transaction Service objects may be saved as pointers for recovery, but as UIDs for persistence. The
OutputObjectStateclass provides convenient operations, so that you can save instances of all of the basic types in Java. To support crash recovery for persistent objects all
save_statemethods need to call
save_statemethod assumes that an object is internally consistent and that all variables saved have valid values. Write and test your code to be sure this is true.
- Restores an object to the specified state. The second parameter allows different interpretations of the supplied state. To support crash recovery for persistent objects all
restore_statemethods need to call
- The JBoss Transaction Service persistence mechanism needs a way to determine the type of an object as a string, so that it can save and restore the state of the object. By convention, the position of the class in the hierarchy is used. For example,
typemethod determines the location of the state of instances of a specified class are saved into the object store. This can actually be any valid string. However, avoid using the hash character #, which is reserved for special directories required by JBoss Transaction Service.