com.cloudtran.coherence.llapi
Class AbstractManagerEventListener

java.lang.Object
  extended by com.cloudtran.coherence.llapi.AbstractManagerEventListener
All Implemented Interfaces:
ManagerEventListener

public class AbstractManagerEventListener
extends Object
implements ManagerEventListener

This is a default implementation of the ManagerEventListener


Constructor Summary
AbstractManagerEventListener()
           
 
Method Summary
 boolean committing(ManagerEvent event, Semaphore semaphore)
          This event is called once the preCommit() method returns successfully.
 void complete(ManagerEvent event)
          This event is called once all actions on this transaction (log, commit to the grid and persist) have completed.
 boolean doLog(ManagerEvent event, Semaphore loggingSemaphore)
          This default implementation
 void preCommit(ManagerEvent event)
          This event is called before the committing state.
 void rollback(ManagerEvent event)
          This event is called when an abort has been called.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractManagerEventListener

public AbstractManagerEventListener()
Method Detail

preCommit

public void preCommit(ManagerEvent event)
               throws TransactionExceptionNonRetriable
Description copied from interface: ManagerEventListener
This event is called before the committing state.

You can do further validation at this point. To abort the transaction, throw a RuntimeException. If this method returns normally, the transaction will commit.

This is an in-manager operation and is performance critical. Do not make any access to caches or any external resource - this should be done by the client application during normal processing.

Specified by:
preCommit in interface ManagerEventListener
Parameters:
event - The ManagerEvent object
Throws:
TransactionExceptionNonRetriable - to indicate that the transaction cannot be committed. It will be rolled back.

committing

public boolean committing(ManagerEvent event,
                          Semaphore semaphore)
Description copied from interface: ManagerEventListener
This event is called once the preCommit() method returns successfully. The transaction is guaranteed to commit before this method is called.

Use this to relay the transaction (using event.gridObjects) to another grid transactionally. Do not do any persistence-related operations here - they should be done in the persister.

Specified by:
committing in interface ManagerEventListener
Parameters:
event - The ManagerEvent object
semaphore - A semaphore for the committing() method to release when its work is done. If this method returns true, it *must* release the semaphore in a timely fashion. If this method returns false, it must *not* release the semaphore.
Returns:
True if the method has handled the action on behalf of the manager: the manager will not call the committing() method any other event listeners.

complete

public void complete(ManagerEvent event)
Description copied from interface: ManagerEventListener
This event is called once all actions on this transaction (log, commit to the grid and persist) have completed.

It does not include transactions have been aborted

Specified by:
complete in interface ManagerEventListener
Parameters:
event - The ManagerEvent object

rollback

public void rollback(ManagerEvent event)
Description copied from interface: ManagerEventListener
This event is called when an abort has been called.

The abort process can not be guaranteed to have finished when this event is called.

Specified by:
rollback in interface ManagerEventListener
Parameters:
event - The ManagerEvent object

doLog

public boolean doLog(ManagerEvent event,
                     Semaphore loggingSemaphore)
This default implementation

Specified by:
doLog in interface ManagerEventListener
Parameters:
event - The ManagerEvent object
Returns: