org.objectweb.easybeans.transaction
Class SessionSynchronizationListener

java.lang.Object
  extended by org.objectweb.easybeans.transaction.SessionSynchronizationListener
All Implemented Interfaces:
javax.transaction.Synchronization

public class SessionSynchronizationListener
extends java.lang.Object
implements javax.transaction.Synchronization

This listener will be notified by the transaction manager and will call methods on the bean.

Author:
Florent Benoit

Field Summary
private  boolean ready
          This listener is ready to receive event from the transaction manager.
private  javax.ejb.SessionSynchronization synchronizedBean
          Bean on which synchonization will be done.
 
Constructor Summary
SessionSynchronizationListener(javax.ejb.SessionSynchronization synchronizedBean)
          Creates a listener which will act on the given bean.
 
Method Summary
 void afterCompletion(int status)
          This method is called by the transaction manager after the transaction is committed or rolled back.
 void beforeCompletion()
          4.3.11 Interceptors for Session Beans.
For stateful session beans that implement the SessionSynchronization interface, afterBegin occurs before any AroundInvoke method invocation, and beforeCompletion after all AroundInvoke invocations are finished.
The beforeCompletion method is called by the transaction manager prior to the start of the two-phase transaction commit process.
 void inTX()
          Sets the ready state to false as the transaction is in progress.
 boolean isReady()
          Gets the ready state of this listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

synchronizedBean

private javax.ejb.SessionSynchronization synchronizedBean
Bean on which synchonization will be done.


ready

private boolean ready
This listener is ready to receive event from the transaction manager.

Constructor Detail

SessionSynchronizationListener

public SessionSynchronizationListener(javax.ejb.SessionSynchronization synchronizedBean)
Creates a listener which will act on the given bean.

Parameters:
synchronizedBean - bean on which call synchronization methods.
Method Detail

beforeCompletion

public void beforeCompletion()
4.3.11 Interceptors for Session Beans.
For stateful session beans that implement the SessionSynchronization interface, afterBegin occurs before any AroundInvoke method invocation, and beforeCompletion after all AroundInvoke invocations are finished.
The beforeCompletion method is called by the transaction manager prior to the start of the two-phase transaction commit process. This call is executed with the transaction context of the transaction that is being committed.

Specified by:
beforeCompletion in interface javax.transaction.Synchronization

afterCompletion

public void afterCompletion(int status)
This method is called by the transaction manager after the transaction is committed or rolled back.

Specified by:
afterCompletion in interface javax.transaction.Synchronization
Parameters:
status - The status of the transaction completion.

isReady

public boolean isReady()
Gets the ready state of this listener.

Returns:
true/false

inTX

public void inTX()
Sets the ready state to false as the transaction is in progress.