org.objectweb.easybeans.transaction.interceptors
Class ListenerSessionSynchronizationInterceptor

java.lang.Object
  extended by org.objectweb.easybeans.transaction.interceptors.AbsTransactionInterceptor
      extended by org.objectweb.easybeans.transaction.interceptors.ListenerSessionSynchronizationInterceptor
All Implemented Interfaces:
EasyBeansInterceptor

public class ListenerSessionSynchronizationInterceptor
extends AbsTransactionInterceptor

This interceptor will add on the current transaction an object which will listen the transaction synchronization and call methods on a bean.

Author:
Florent Benoit

Field Summary
private  java.util.Map<java.lang.Object,SessionSynchronizationListener> listeners
          Listener which will receive event of the transaction manager.
private  JLog logger
          Logger.
 
Constructor Summary
ListenerSessionSynchronizationInterceptor()
           
 
Method Summary
private  void addSynchronization(EasyBeansInvocationContext invocationContext)
          Add a synchronization listener to the transaction manager in order to be notified and send actions on the bean.
 java.lang.Object intercept(EasyBeansInvocationContext invocationContext)
          Adds a listener object receiving calls from the transaction manager.
 
Methods inherited from class org.objectweb.easybeans.transaction.interceptors.AbsTransactionInterceptor
getTransactionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private JLog logger
Logger.


listeners

private java.util.Map<java.lang.Object,SessionSynchronizationListener> listeners
Listener which will receive event of the transaction manager.

Constructor Detail

ListenerSessionSynchronizationInterceptor

public ListenerSessionSynchronizationInterceptor()
Method Detail

intercept

public java.lang.Object intercept(EasyBeansInvocationContext invocationContext)
                           throws java.lang.Exception
Adds a listener object receiving calls from the transaction manager.

Specified by:
intercept in interface EasyBeansInterceptor
Specified by:
intercept in class AbsTransactionInterceptor
Parameters:
invocationContext - context with useful attributes on the current invocation
Returns:
result of the next invocation (to chain interceptors).
Throws:
java.lang.Exception - if interceptor fails
See Also:
EJB 3.0 specification ?12.6.2.2

addSynchronization

private void addSynchronization(EasyBeansInvocationContext invocationContext)
Add a synchronization listener to the transaction manager in order to be notified and send actions on the bean. It should be done only once until transaction is completed.

Parameters:
invocationContext - the context on the current invocation.