com.sleepycat.je.trigger
Interface PersistentTrigger

All Superinterfaces:
Serializable, Trigger
All Known Implementing Classes:
SyncCleanerBarrier.SyncTrigger

public interface PersistentTrigger
extends Trigger, Serializable

Placeholder to be used when persistent triggers are supported in the future. See warning at the top of Trigger.java

Note that all subtypes of PersistentTrigger must be serializable, because they are stored persistently in the environment.

The following table captures the relationship between the database granularity operations and their associated trigger methods.

Database Operation Trigger Method
Environment.openDatabase resulting in the creation of a new primary database. Or the first open of a database for write operations. open
Database.close the close of a database that was opened for write operations. close
Environment.removeDatabase remove
Environment.truncateDatabase truncate
Environment.renameDatabase rename


Method Summary
 void close()
          The trigger method associated with the close of the last writable Database handle.
 void open(Transaction txn, Environment environment, boolean isNew)
          The trigger method invoked after the open of the first Database writable handle.
 void remove(Transaction txn)
          The trigger method invoked after the successful removal of a primary Database.
 void rename(Transaction txn, String newName)
          The trigger method invoked after the successful renaming of a primary Database.
 void truncate(Transaction txn)
          The trigger method invoked after the successful truncation of a Database.
 
Methods inherited from interface com.sleepycat.je.trigger.Trigger
addTrigger, delete, getDatabaseName, getName, put, removeTrigger, setDatabaseName
 

Method Detail

open

void open(Transaction txn,
          Environment environment,
          boolean isNew)
The trigger method invoked after the open of the first Database writable handle. A call to the open trigger always precedes any subsequent calls to the Trigger.put(com.sleepycat.je.Transaction, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry) and Trigger.delete(com.sleepycat.je.Transaction, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry) triggers defined below, since the put and delete operations can only be invoked on a database handle.

If the database is replicated, the replay mechanism on a Replica may open and close databases as it replays the replication stream. The maximum number of databases that may be open at any given time and the duration for which they can be left open can be controlled by configuring ReplicationConfig.REPLAY_MAX_OPEN_DB_HANDLES and ReplicationConfig.REPLAY_DB_HANDLE_TIMEOUT respectively.

The method may be invoked when the database is first created, or subsequently when a new trigger is added to an existing database. As a result, a call to this trigger is always preceded by a call to the addTrigger trigger method.

Parameters:
txn - the active transaction associated with the operation. The argument is null if the operation is not transactional.
environment - a handle to the environment associated with the database being opened. The trigger code must not close the environment handle.
isNew - is true if the database was newly created as a result of the call to Environment.openDatabase(com.sleepycat.je.Transaction, java.lang.String, com.sleepycat.je.DatabaseConfig)
See Also:
Environment.openDatabase(com.sleepycat.je.Transaction, java.lang.String, com.sleepycat.je.DatabaseConfig)

close

void close()
The trigger method associated with the close of the last writable Database handle.

If the database is replicated, the replay mechanism on a Replica may open and close databases as it replays the replication stream. The maximum number of databases that may be open at any given time and the duration for which they can be left open can be controlled by configuring ReplicationConfig.REPLAY_MAX_OPEN_DB_HANDLES and ReplicationConfig.REPLAY_DB_HANDLE_TIMEOUT respectively.

See Also:
Database#close

remove

void remove(Transaction txn)
The trigger method invoked after the successful removal of a primary Database.

Parameters:
txn - the transaction associated with the operation. The argument is null if the environment is non-transactional.
See Also:
Environment.removeDatabase(com.sleepycat.je.Transaction, java.lang.String)

truncate

void truncate(Transaction txn)
The trigger method invoked after the successful truncation of a Database.

Parameters:
txn - the transaction associated with the operation. The argument is null if the environment is non-transactional.
See Also:
Environment.truncateDatabase(com.sleepycat.je.Transaction, java.lang.String, boolean)

rename

void rename(Transaction txn,
            String newName)
The trigger method invoked after the successful renaming of a primary Database.

Parameters:
txn - the transaction associated with the operation. The argument is null if the environment is non-transactional.
newName - it's current (new) name
See Also:
Environment.renameDatabase(com.sleepycat.je.Transaction, java.lang.String, java.lang.String)


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