FileDocCategorySizeDatePackage
StateManager.javaAPI DocJBoss 4.2.13916Fri Jul 13 21:02:32 BST 2007org.jboss.aspects.versioned

StateManager

public abstract class StateManager extends Object implements Externalizable
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
public static final String
STATE_MANAGER
protected static Logger
log
protected org.jboss.util.id.GUID
guid
protected long
timeout
protected transient EDU.oswego.cs.dl.util.concurrent.ReadWriteLock
lock
Constructors Summary
public StateManager()


     
public StateManager(org.jboss.util.id.GUID guid, long timeout)

      this.guid = guid;
      this.timeout = timeout;
   
Methods Summary
public voidacquireReadLock()

      try
      {
         if (!lock.readLock().attempt(timeout))
         {
            throw new LockAttemptFailure("failed to acquire read lock: " + guid);
         }
         log.trace("readlock acquired for: " + guid);
      }
      catch (InterruptedException ignored)
      {
         throw new LockAttemptFailure("failed to acquire read lock: " + guid);
      }
   
public voidacquireWriteLock()

      try
      {
         if (!lock.writeLock().attempt(timeout))
         {
            throw new LockAttemptFailure("failed to acquire write lock: " + guid);
         }
         log.trace("writelock acquired for: " + guid);
      }
      catch (InterruptedException ignored)
      {
         throw new LockAttemptFailure("failed to acquire write lock: " + guid);
      }
   
public org.jboss.util.id.GUIDgetGUID()

 return guid; 
public EDU.oswego.cs.dl.util.concurrent.ReadWriteLockgetLock()

 return lock; 
public static org.jboss.aspects.versioned.StateManagergetStateManager(org.jboss.aop.InstanceAdvised obj)



       
   
      return (StateManager)obj._getInstanceAdvisor().getMetaData().getMetaData(STATE_MANAGER, STATE_MANAGER);
   
public voidreadExternal(java.io.ObjectInput in)

      this.guid = (GUID)in.readObject();
      this.timeout = in.readLong();
      this.lock = new WriterPreferenceReadWriteLock();
   
public voidreleaseReadLock()

      lock.readLock().release();
      log.trace("readlock released for: " + guid);
public voidreleaseWriteLock()

      lock.writeLock().release();
      log.trace("writelock released for: " + guid);
   
public static voidsetStateManager(org.jboss.aop.InstanceAdvised obj, org.jboss.aspects.versioned.StateManager manager)

      obj._getInstanceAdvisor().getMetaData().addMetaData(STATE_MANAGER, STATE_MANAGER, manager, PayloadKey.TRANSIENT);
   
public voidwriteExternal(java.io.ObjectOutput out)

      out.writeObject(guid);
      out.writeLong(timeout);