Package org.jboss.stm.internal
Class PersistentContainer<T>
java.lang.Object
org.jboss.stm.internal.RecoverableContainer<T>
org.jboss.stm.internal.PersistentContainer<T>
Instances of this class represent the transactional memory within which persistent user objects
can be placed and managed.
Objects must implement an interface through which all transactional accesses occur. We don't
mandate what the interface is, since that will depend upon the business logic. The interface, or
the implementing class, must also use the @Transactional annotation.
- Author:
- marklittle
-
Field Summary
Fields inherited from class org.jboss.stm.internal.RecoverableContainer
_objectModel, _transactionalProxies, _type
-
Constructor Summary
ConstructorDescriptionCreate a container without a name.PersistentContainer
(int objectModel) Create a container without a name.PersistentContainer
(String name) Create a named container.PersistentContainer
(String name, int objectModel) Create a named container. -
Method Summary
Modifier and TypeMethodDescriptionGiven an object we create a new transactional instance of it and return that for future use.Given a unique identifier, the container will either return an existing handle to the object or recreate the handle with the same state that existed at the commit of the last transaction to use it.toString()
Gives the name of the container.Methods inherited from class org.jboss.stm.internal.RecoverableContainer
checkObjectType, createHandle, enlist, getHandle, getUidForHandle, getUidForOriginal, isPessimistic, name, objectModel, objectType
-
Constructor Details
-
PersistentContainer
public PersistentContainer()Create a container without a name. A name will be assigned automatically. -
PersistentContainer
Create a named container.- Parameters:
name
- the name (should be unique, but this is not enforced).
-
PersistentContainer
public PersistentContainer(int objectModel) Create a container without a name. A name will be assigned automatically.- Parameters:
global
- whether the instances are to be shared across address spaces or classloaders.
-
PersistentContainer
Create a named container.- Parameters:
name
- the name (should be unique, but this is not enforced).global
- whether the instances are to be shared across address spaces or classloaders.
-
-
Method Details
-
enlist
Given an object we create a new transactional instance of it and return that for future use. All accesses on the returned object will be managed according to the rules defined in the various annotations. If the original object instance is used then no transactional manipulation will occur so you need to be careful! All handles are uniquely identified using Uid.- Overrides:
enlist
in classRecoverableContainer<T>
- Parameters:
member
- the instance of type T that you want to be made transactional and persistent.- Returns:
- a handle into the transactional memory that the application should use to manipulate the object.
-
recreate
Given a unique identifier, the container will either return an existing handle to the object or recreate the handle with the same state that existed at the commit of the last transaction to use it.- Parameters:
member
- the instance of type T that you want to be made transactional and persistent.id
- the unique identifier for the instance.- Returns:
- a handle into the transactional memory that the application should use to manipulate the object.
-
toString
Gives the name of the container.- Overrides:
toString
in classRecoverableContainer<T>
-