Class PersistentContainer<T>

java.lang.Object
org.jboss.stm.internal.RecoverableContainer<T>
org.jboss.stm.internal.PersistentContainer<T>

public class PersistentContainer<T> extends RecoverableContainer<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
  • Constructor Details

    • PersistentContainer

      public PersistentContainer()
      Create a container without a name. A name will be assigned automatically.
    • PersistentContainer

      public PersistentContainer(String name)
      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

      public PersistentContainer(String name, int objectModel)
      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

      public T enlist(T member)
      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 class RecoverableContainer<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

      public T recreate(T member, Uid id)
      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

      public String toString()
      Gives the name of the container.
      Overrides:
      toString in class RecoverableContainer<T>