com.sun.sgs.service
Interface TransactionListener


public interface TransactionListener

A listener to be notified before and after the completion of a transaction.

Callers can register TransactionListeners to learn about the completion of a transaction without joining the transaction as a TransactionParticipant. Because Services may depend on operations performed by the TransactionListener.beforeCompletion methods of listeners that they register, beforeCompletion methods should not make calls to other services, even though the transaction is still considered active when beforeCompletion is called. The results of such calls are unspecified.

See Also:
Transaction.registerListener

Method Summary
 void afterCompletion(boolean committed)
          Called after a transaction is committed or aborted.
 void beforeCompletion()
          Called after the main work of the transaction is complete, just before the transaction is prepared.
 String getTypeName()
          Returns the fully qualified type name of the listener.
 

Method Detail

beforeCompletion

void beforeCompletion()
Called after the main work of the transaction is complete, just before the transaction is prepared. The transaction is still considered active when this method is called, although calls should not be made to independent Services. If the transaction has multiple transaction listeners registered, the order in which the listeners are called is unspecified.

If this method throws an exception, then the transaction will be aborted, and the exception will be treated as if it were thrown by the main body of the transaction.

This method will not be called if the transaction is aborted before it reaches the preparation stage, including if an earlier call to this method on another listener throws an exception or aborts the transaction.

Throws:
RuntimeException - if the transaction should be aborted

afterCompletion

void afterCompletion(boolean committed)
Called after a transaction is committed or aborted. The parameter will be set to true if the transaction committed, else false if it aborted. If the transaction has multiple transaction listeners registered, the order in which the listeners are called is unspecified.

Parameters:
committed - true if the transaction committed, else false if it aborted

getTypeName

String getTypeName()
Returns the fully qualified type name of the listener. Typically this is the implementing class or some other distinguishing name that will remain constant between transactions.

Returns:
the name of the listener

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved