jrun.ejb.interceptors
Class TransactionInterceptor

jrunx.kernel.ServiceAdapter
  |
  +--jrun.ejb.interceptors.AbstractInterceptor
        |
        +--jrun.ejb.interceptors.TransactionInterceptor
All Implemented Interfaces:
Interceptor, InterceptorMBean, javax.naming.Referenceable, java.io.Serializable, Service, ServiceMBean, TransactionInterceptorMBean
Direct Known Subclasses:
ContainerManagedTransactionInterceptor

public class TransactionInterceptor
extends AbstractInterceptor
implements TransactionInterceptorMBean

The base XA-aware Interceptor for EJB containers. This interceptor is added directly to containers that make use of bean-managed transactions. One purpose of this interceptor is to suspend client transactions before invoking a bean method and resuming the client transaction afterwards. Another purpose is to properly affect the outcome of bean-managed transactions according to Exceptions that may be thrown during the course of the EJB invocation.
Containers with Container-Managed transactions do not directly use this interceptor, but instead make use of its ContainerManagedTransaction subclass.

Author:
PS Neville, Paul Reilly
See Also:
Serialized Form

Field Summary
static java.lang.String OBJECT_NAME
           
protected  javax.transaction.TransactionManager tm
           
 
Fields inherited from class jrun.ejb.interceptors.AbstractInterceptor
container, ISFIRST_MESSAGE, ISLAST_MESSAGE, next, previous
 
Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
TransactionInterceptor(EJBContainer ejbContainer)
           
 
Method Summary
protected  void handleTransactionException(java.lang.Exception e, EJBInvocation ejbInvocation)
          Ensure that certain Exceptions cause any active TX to be marked for rollback only.
 java.lang.Object invokeHomeMethod(EJBInvocation ejbInvocation)
          Home method ejbInvocations require transactional creates.
 java.lang.Object invokeObjectMethod(EJBInvocation ejbInvocation)
          Invoke the EJBObject method within the specified transaction parameters.
protected  java.lang.Object invokeTransactedMethod(EJBInvocation ejbInvocation, boolean isHomeMethod)
           
 void start()
          Every service other than mere data collections should start
 
Methods inherited from class jrun.ejb.interceptors.AbstractInterceptor
getContainer, getContainerName, getEJBMetaData, getNext, getNextInterceptorName, getPrevious, getPreviousInterceptorName, setNext, setPrevious
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, destroy, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, init, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, stop, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrun.ejb.InterceptorMBean
getContainerName, getNextInterceptorName, getPreviousInterceptorName
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
destroy, getStatus, init, stop, updateStatus
 

Field Detail

tm

protected javax.transaction.TransactionManager tm

OBJECT_NAME

public static final java.lang.String OBJECT_NAME
Constructor Detail

TransactionInterceptor

public TransactionInterceptor(EJBContainer ejbContainer)
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from class: ServiceAdapter
Every service other than mere data collections should start
Specified by:
start in interface Service
Overrides:
start in class ServiceAdapter

invokeHomeMethod

public java.lang.Object invokeHomeMethod(EJBInvocation ejbInvocation)
                                  throws java.lang.Exception
Home method ejbInvocations require transactional creates.
Overrides:
invokeHomeMethod in class AbstractInterceptor

invokeObjectMethod

public java.lang.Object invokeObjectMethod(EJBInvocation ejbInvocation)
                                    throws java.lang.Exception
Invoke the EJBObject method within the specified transaction parameters.
Overrides:
invokeObjectMethod in class AbstractInterceptor

invokeTransactedMethod

protected java.lang.Object invokeTransactedMethod(EJBInvocation ejbInvocation,
                                                  boolean isHomeMethod)
                                           throws java.lang.Exception

handleTransactionException

protected void handleTransactionException(java.lang.Exception e,
                                          EJBInvocation ejbInvocation)
                                   throws java.lang.Exception
Ensure that certain Exceptions cause any active TX to be marked for rollback only.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.