FileDocCategorySizeDatePackage
TxLockInterceptorFactory.javaAPI DocJBoss 4.2.13407Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.txlock

TxLockInterceptorFactory

public class TxLockInterceptorFactory extends Object implements org.jboss.aop.advice.AspectFactory
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectcreatePerClass(org.jboss.aop.Advisor advisor)

      QueuedTxLock lock = new QueuedTxLock();
      advisor.getClassMetaData().addMetaData(QueuedTxLock.TXLOCK, QueuedTxLock.TXLOCK, lock, PayloadKey.TRANSIENT);
      return new TxLockInterceptor(getTransactionManager(), lock);

   
public java.lang.ObjectcreatePerInstance(org.jboss.aop.Advisor advisor, org.jboss.aop.InstanceAdvisor instanceAdvisor)

      SimpleMetaData instanceData = instanceAdvisor.getMetaData();
      QueuedTxLock lock = null;
      synchronized(instanceData)
      {
         lock = (QueuedTxLock)instanceData.getMetaData(QueuedTxLock.TXLOCK, QueuedTxLock.TXLOCK);
         if (lock == null)
         {
            lock = new QueuedTxLock();
            instanceData.addMetaData(QueuedTxLock.TXLOCK, QueuedTxLock.TXLOCK, lock, PayloadKey.TRANSIENT);
         }
      }
      return new TxLockInterceptor(getTransactionManager(), lock);
   
public java.lang.ObjectcreatePerJoinpoint(org.jboss.aop.Advisor advisor, org.jboss.aop.joinpoint.Joinpoint jp)

      throw new RuntimeException("this interceptor only supports PER_CLASS and PER_INSTANCE");
   
public java.lang.ObjectcreatePerJoinpoint(org.jboss.aop.Advisor advisor, org.jboss.aop.InstanceAdvisor instanceAdvisor, org.jboss.aop.joinpoint.Joinpoint jp)

      throw new RuntimeException("this interceptor only supports PER_CLASS and PER_INSTANCE");
   
public java.lang.ObjectcreatePerVM()

      throw new RuntimeException("this interceptor only supports PER_CLASS and PER_INSTANCE");
   
public java.lang.StringgetName()

      return getClass().getName();
   
private static javax.transaction.TransactionManagergetTransactionManager()

      try
      {
         InitialContext ctx = new InitialContext();
         TransactionManager tm = (TransactionManager) ctx.lookup("java:/TransactionManager");
         return tm;
      }
      catch (NamingException e)
      {
         throw new RuntimeException(e);
      }