FileDocCategorySizeDatePackage
TransactionLocalAspect.javaAPI DocJBoss 4.2.12639Fri Jul 13 21:02:30 BST 2007org.jboss.aspects.tx

TransactionLocalAspect

public class TransactionLocalAspect extends Object
This aspect should be scoped PER_JOINPOINT It allows a field to have the value of itself pertain to the current transaction. The fields transactional and non-transactional value is always separate At tx commit, the transactional value the field had is wiped away. At tx commit, the transactional value does not correspond to the non-transactional value If you are within a transaction and you get the value of the field before setting it then the initial transational value will be set to the current non-transactional value
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
private org.jboss.tm.TransactionLocal
txLocal
Constructors Summary
Methods Summary
public java.lang.Objectaccess(org.jboss.aop.joinpoint.FieldReadInvocation invocation)


        
   
      // Return non-Tx value
      if (txLocal.getTransaction() == null) return invocation.invokeNext();

      // just in case we have a primitive, we can't return null so set txLocal to be the current nonTx value
      if (txLocal.get() == null)
      {
         txLocal.set(invocation.invokeNext());
      }
      return txLocal.get();
   
public java.lang.Objectaccess(org.jboss.aop.joinpoint.FieldWriteInvocation invocation)

      // Return non-Tx value
      if (txLocal.getTransaction() == null) return invocation.invokeNext();

      txLocal.set(invocation.getValue());
      return null;