public interface PersistentTrigger extends Trigger, Serializable
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 |
| Modifier and Type | Method and Description |
|---|---|
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. |
addTrigger, delete, getDatabaseName, getName, put, removeTrigger, setDatabaseNamevoid open(Transaction txn, Environment environment, boolean isNew)
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.
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)Environment.openDatabase(com.sleepycat.je.Transaction, java.lang.String, com.sleepycat.je.DatabaseConfig)void close()
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.
Database.close()void remove(Transaction txn)
Database.txn - the transaction associated with the operation. The argument
is null if the environment is non-transactional.Environment.removeDatabase(com.sleepycat.je.Transaction, java.lang.String)void truncate(Transaction txn)
Database.txn - the transaction associated with the operation. The argument
is null if the environment is non-transactional.Environment.truncateDatabase(com.sleepycat.je.Transaction, java.lang.String, boolean)void rename(Transaction txn, String newName)
Database.txn - the transaction associated with the operation. The argument
is null if the environment is non-transactional.newName - it's current (new) nameEnvironment.renameDatabase(com.sleepycat.je.Transaction, java.lang.String, java.lang.String)Copyright © 2024. All rights reserved.