com.sleepycat.je.trigger
Interface TransactionTrigger

All Known Implementing Classes:
SyncCleanerBarrier.SyncTrigger

public interface TransactionTrigger

TransactionTrigger defines the methods that track a transaction through its lifecycle. The following table captures the relationship between transaction lifecycle operations and their trigger methods.

WARNING: Only transient triggers are currently supported, and the documention below has not yet been updated to reflect this fact. See details at the top of Trigger.java. Also see the warning at the top of ReplicatedDatabaseTrigger.java.

Transaction Operation Trigger Method
Transaction.commit. If the database was was modified in the scope of the transaction. commit
Transaction.abort. If the database was was modified in the scope of the transaction. abort

The use of method names in the above table is intended to cover all overloaded methods with that name.

The trigger methods are also invoked for transactions that are implicitly initiated on behalf of the application in the following two cases:

  1. When using auto-commit.
  2. During the replay of transactions on a Replica when using a ReplicatedEnvironment.

A TransactionTrigger is associated with a database via DatabaseConfig.setTriggers.

Trigger applications that only make changes to the JE environment in the transaction scope of the transaction supplied to the DatbaseTrigger do not typically need to define Transaction triggers, since the changes they make are committed and rolled back automatically by this transaction. For example, triggers defined solely to create additional indexes in the environment do not need to define transaction triggers. Only sophisticated applications that manage state outside of JE, or in independent transactions typically define such triggers.


Method Summary
 void abort(Transaction txn)
          The trigger method invoked after the transaction has been aborted.
 void commit(Transaction txn)
          The trigger method invoked after a transaction has been committed.
 

Method Detail

commit

void commit(Transaction txn)
The trigger method invoked after a transaction has been committed. The method is only invoked if the database was modified during the course of the transaction, that is, if a DatabaseTrigger trigger method was invoked within the scope of the transaction.

Parameters:
txn - the transaction that was committed

abort

void abort(Transaction txn)
The trigger method invoked after the transaction has been aborted. The method is only invoked if the database was modified during the course of the transaction, that is, if a DatabaseTrigger trigger method was invoked within the scope of the transaction.

Parameters:
txn - the transaction that was aborted


Copyright (c) 2004-2012 Oracle. All rights reserved.