org.jboss.aspects.tx
Class TxPolicy

java.lang.Object
  extended by org.jboss.aspects.tx.TxPolicy

public class TxPolicy
extends Object

TxSupport.java encapsulates the transaction handling possibilities from the ejb spec. The Tx interceptors call the clientInvoke and serverInvoke methods on the subclass determined by the method's transaction support.

Created: Sun Feb 2 23:25:09 2003

Author:
David Jencks, Bill Burke

Field Summary
protected static org.jboss.logging.Logger log
           
static int MAX_RETRIES
           
static Random random
           
 
Constructor Summary
TxPolicy()
           
 
Method Summary
 void endTransaction(TransactionManager tm, Transaction tx)
          The endTransaction method ends a transaction and translates any exceptions into TransactionRolledBack[Local]Exception or SystemException.
 void handleEndTransactionException(Exception e)
           
 void handleExceptionInOurTx(org.jboss.aop.joinpoint.Invocation invocation, Throwable t, Transaction tx)
           
 void handleInCallerTx(org.jboss.aop.joinpoint.Invocation invocation, Throwable t, Transaction tx)
           
 Object invokeInCallerTx(org.jboss.aop.joinpoint.Invocation invocation, Transaction tx)
           
 Object invokeInNoTx(org.jboss.aop.joinpoint.Invocation invocation)
           
 Object invokeInOurTx(org.jboss.aop.joinpoint.Invocation invocation, TransactionManager tm)
           
 void rethrowApplicationException(org.jboss.aop.joinpoint.Invocation inv, Throwable e)
          The rethrowApplicationException method determines if the supplied Throwable is an application exception and rethrows it if it is.
 void setRollbackOnly(Transaction tx)
          The setRollbackOnly method calls setRollbackOnly() on the invocation's transaction and logs any exceptions than may occur.
 void throwMandatory(org.jboss.aop.joinpoint.Invocation invocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log

MAX_RETRIES

public static int MAX_RETRIES

random

public static Random random
Constructor Detail

TxPolicy

public TxPolicy()
Method Detail

throwMandatory

public void throwMandatory(org.jboss.aop.joinpoint.Invocation invocation)

invokeInNoTx

public Object invokeInNoTx(org.jboss.aop.joinpoint.Invocation invocation)
                    throws Throwable
Throws:
Throwable

invokeInOurTx

public Object invokeInOurTx(org.jboss.aop.joinpoint.Invocation invocation,
                            TransactionManager tm)
                     throws Throwable
Throws:
Throwable

handleExceptionInOurTx

public void handleExceptionInOurTx(org.jboss.aop.joinpoint.Invocation invocation,
                                   Throwable t,
                                   Transaction tx)
                            throws Throwable
Throws:
Throwable

invokeInCallerTx

public Object invokeInCallerTx(org.jboss.aop.joinpoint.Invocation invocation,
                               Transaction tx)
                        throws Throwable
Throws:
Throwable

handleInCallerTx

public void handleInCallerTx(org.jboss.aop.joinpoint.Invocation invocation,
                             Throwable t,
                             Transaction tx)
                      throws Throwable
Throws:
Throwable

endTransaction

public void endTransaction(TransactionManager tm,
                           Transaction tx)
The endTransaction method ends a transaction and translates any exceptions into TransactionRolledBack[Local]Exception or SystemException.

Parameters:
invocation - an Invocation value
tm - a TransactionManager value
tx - a Transaction value
Throws:
TransactionRolledbackException - if an error occurs
SystemException - if an error occurs

handleEndTransactionException

public void handleEndTransactionException(Exception e)

setRollbackOnly

public void setRollbackOnly(Transaction tx)
The setRollbackOnly method calls setRollbackOnly() on the invocation's transaction and logs any exceptions than may occur.

Parameters:
invocation - an Invocation value

rethrowApplicationException

public void rethrowApplicationException(org.jboss.aop.joinpoint.Invocation inv,
                                        Throwable e)
                                 throws Throwable
The rethrowApplicationException method determines if the supplied Throwable is an application exception and rethrows it if it is.

Parameters:
e - a Throwable value
Throws:
Exception - if an error occurs
Throwable


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.