Package org.jboss.stm.internal
Class RecoverableContainer<T>
java.lang.Object
org.jboss.stm.internal.RecoverableContainer<T>
- Direct Known Subclasses:
PersistentContainer
Instances of this class represent the transactional memory within which non-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
-
Constructor Summary
ModifierConstructorDescriptionCreate a container without a name.protected
RecoverableContainer
(int objectModel) RecoverableContainer
(String name) Create a named container.protected
RecoverableContainer
(String name, int objectModel) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
checkObjectType
(Object member) protected T
createHandle
(T member, int ot) Return a handle through which the object should be used, rather than the one passed in.Given an object we create a new transactional instance of it and return that for future use.Given an identified for an existing object, create another handle.Given a Uid, return the proxy for that instance.getUidForHandle
(T proxy) Given a real object, return the Uid if it exists in this container.getUidForOriginal
(T member) Given a real object, return the Uid if it exists in this container.final boolean
isPessimistic
(Object member) final String
name()
Get the name of the container.final int
final int
toString()
Gives the name of the container.
-
Field Details
-
_transactionalProxies
-
_type
protected int _type -
_objectModel
protected int _objectModel
-
-
Constructor Details
-
RecoverableContainer
public RecoverableContainer()Create a container without a name. A name will be assigned automatically. -
RecoverableContainer
Create a named container.- Parameters:
name
- the name (should be unique, but this is not enforced).
-
RecoverableContainer
protected RecoverableContainer(int objectModel) -
RecoverableContainer
-
-
Method Details
-
name
Get the name of the container.- Returns:
- the name.
-
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.- 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.
-
enlist
Given an identified for an existing object, create another handle. This is particularly useful when using pessimistic concurrency control and we need one object instance per thread to ensure that state is safely managed.- Parameters:
member
- the instance of type T that you want to be made transactional and persistent.id
- the Uid of the object.- Returns:
- a handle into the transactional memory that the application should use to manipulate the object.
-
createHandle
Return a handle through which the object should be used, rather than the one passed in. Can specify the type of the object (recoverable, persistent, neither). -
getHandle
Given a Uid, return the proxy for that instance.- Parameters:
reference
- the unique identifier for the handle.- Returns:
- the handle or null if not present.
-
getUidForOriginal
Given a real object, return the Uid if it exists in this container.- Parameters:
member
- the real object.- Returns:
- the Uid for the object.
-
getUidForHandle
Given a real object, return the Uid if it exists in this container.- Parameters:
member
- the real object.- Returns:
- the Uid for the object if it exists in the container.
-
toString
Gives the name of the container. -
objectType
public final int objectType() -
objectModel
public final int objectModel() -
isPessimistic
-
checkObjectType
-