org.objectweb.jonas_ejb.container
Class TxListener

java.lang.Object
  extended byorg.objectweb.jonas_ejb.container.TxListener
All Implemented Interfaces:
javax.transaction.Synchronization

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

This class is a listener on the transaction. It is registered as a Synchronization on the current transaction. It holds the list of all instances that are possibly modified during the transaction.

Author:
Philippe Durieux

Constructor Summary
TxListener(JEntityFactory bf, javax.transaction.Transaction tx)
          constructor
 
Method Summary
 void addInstance(JEntityContext ec)
          Add a new Context in the list.
 void afterCompletion(int status)
          The afterCompletion method is called by the transaction manager after the transaction is committed or rolled back.
 void beforeCompletion()
          This beforeCompletion method is called by the transaction manager prior to the start of the transaction completion process.
 void storeInstances()
          Synchronizes all instances on disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TxListener

public TxListener(JEntityFactory bf,
                  javax.transaction.Transaction tx)
constructor

Method Detail

storeInstances

public void storeInstances()
Synchronizes all instances on disk. This must be called before every SQL request (finder) or at beforeCompletion(). We must be in the good transaction context here, and with the correct component environment (java:comp).


addInstance

public void addInstance(JEntityContext ec)
Add a new Context in the list.


beforeCompletion

public void beforeCompletion()
This beforeCompletion method is called by the transaction manager prior to the start of the transaction completion process. This method executes in the transaction context of the calling thread. The Bean's state must be stored on the persistent storage before the completion of the transaction.

Specified by:
beforeCompletion in interface javax.transaction.Synchronization

afterCompletion

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

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