@Managed public class TransactionNotifier extends java.lang.Object
Transaction notifier
This class is used for prepare, commit and abort callbacks for the current transaction. Users extend this class and implement any or all of the onPrepare(), onCommit() and onRollback() methods.
Creating an instance of this class enables the prepare, commit and abort callbacks for the current transaction.
If this class is deleted before the prepare, commit or abort, the callbacks will not be invoked.
The instance will automatically delete itself at the end of the transaction.
Because onCommit and onRollback are called at transaction commit or abort time, these methods are not allowed to lock any new objects or resources, or promote any existing read locks to write locks. This will result in a fatal runtime exception. They are allowed to access any objects or resources that are currently locked in the transaction.
The onPrepare operation is allowed to perform additional work within the transaction. If a system exception is thrown in onPrepare, the exception is propagated to the caller and the transaction rolled back.
Transaction notifier callbacks are always executed on the local node, even if the notifier instance is a distributed reference.
Constructor and Description |
---|
TransactionNotifier()
Create a new TransactionNotifier
|
Modifier and Type | Method and Description |
---|---|
void |
onCommit()
Commit notification
|
void |
onPrepare()
Prepare notification
|
void |
onRollback()
Abort notification
|
public TransactionNotifier()
public void onPrepare()
Prepare notification
Called when the transaction that this instance was created in does a prepare.
public void onCommit()
Commit notification
Called when the transaction that this instance was created in commits.
public void onRollback()
Abort notification
Called when the transaction that this instance was created in aborts.