com.sleepycat.je.sync.impl
Class SyncCleanerBarrier.SyncTrigger

java.lang.Object
  extended by com.sleepycat.je.sync.impl.SyncCleanerBarrier.SyncTrigger
All Implemented Interfaces:
PersistentTrigger, ReplicatedDatabaseTrigger, TransactionTrigger, Trigger, Serializable
Enclosing class:
SyncCleanerBarrier

public static class SyncCleanerBarrier.SyncTrigger
extends Object
implements Trigger, TransactionTrigger, ReplicatedDatabaseTrigger, PersistentTrigger

See Also:
Serialized Form

Constructor Summary
SyncCleanerBarrier.SyncTrigger(String triggerName)
           
 
Method Summary
 void abort(Transaction txn)
          The trigger method invoked after the transaction has been aborted.
 void addTrigger(Transaction txn)
          The trigger method invoked when this trigger is added to the database.
 void close()
          The trigger method associated with the close of the last writable Database handle.
 void commit(Transaction txn)
          The trigger method invoked after a transaction has been committed.
 void delete(Transaction txn, DatabaseEntry key, DatabaseEntry oldData)
          The trigger method invoked after a successful delete, that is, one that actually resulted in a key/value pair being removed.
 String getDatabaseName()
          Returns the result of the Trigger.setDatabaseName(String) operation.
 String getName()
          Returns the name associated with the trigger.
 void open(Transaction txn, Environment environment, boolean isNew)
          The trigger method invoked after the open of the first Database writable handle.
 void put(Transaction txn, DatabaseEntry key, DatabaseEntry oldData, DatabaseEntry newData)
          The trigger method invoked after a successful put, that is, one that actually results in a modification to the database.
 void remove(Transaction txn)
          The trigger method invoked after the successful removal of a primary Database.
 void removeTrigger(Transaction txn)
          The trigger method invoked when this trigger is removed from the database, either as a result of opening the database with a different trigger configuration, or because the database it was associated with it has been removed.
 void rename(Transaction txn, String newName)
          The trigger method invoked after the successful renaming of a primary Database.
 void repeatAddTrigger(Transaction txn)
          The trigger method invoked when an addTrigger operation needs to be repeated.
 void repeatCreate(Transaction txn)
          The trigger method invoked when a database create trigger needs to be repeated.
 void repeatDelete(Transaction txn, DatabaseEntry key)
          The trigger method invoked when a database delete trigger needs to be repeated.
 void repeatPut(Transaction txn, DatabaseEntry key, DatabaseEntry newData)
          The trigger method invoked when a database put trigger needs to be repeated.
 void repeatRemove(Transaction txn)
          The trigger method invoked when a database remove trigger needs to be repeated.
 void repeatRemoveTrigger(Transaction txn)
          The trigger method invoked when a removeTrigger operation needs to be repeated.
 void repeatRename(Transaction txn, String newName)
          The trigger method invoked when a database rename trigger needs to be repeated.
 void repeatTransaction(Transaction txn)
          Used to inform the application that the trigger method calls associated with the partial transaction will be repeated.
 void repeatTruncate(Transaction txn)
          The trigger method invoked when a database truncate trigger needs to be repeated.
 Trigger setDatabaseName(String dbName)
          Sets the database name associated with this trigger.
 void truncate(Transaction txn)
          The trigger method invoked after the successful truncation of a Database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncCleanerBarrier.SyncTrigger

public SyncCleanerBarrier.SyncTrigger(String triggerName)
Method Detail

getName

public String getName()
Description copied from interface: Trigger
Returns the name associated with the trigger. All the triggers associated with a particular database must have unique names.

Specified by:
getName in interface Trigger
Returns:
the Trigger's name

setDatabaseName

public Trigger setDatabaseName(String dbName)
Description copied from interface: Trigger
Sets the database name associated with this trigger. The JE trigger mechanism invokes this method to ensure that the trigger knows the name it's associated with across a rename of the database.

This method is also invoked each time the trigger is de-serialized, so that the trigger does not need to store this information as part of it's serialized representation.

Specified by:
setDatabaseName in interface Trigger
Parameters:
dbName - the name of the database associated with this trigger
Returns:
this

getDatabaseName

public String getDatabaseName()
Description copied from interface: Trigger
Returns the result of the Trigger.setDatabaseName(String) operation.

Specified by:
getDatabaseName in interface Trigger
Returns:
the name of the database associated with this trigger

addTrigger

public void addTrigger(Transaction txn)
Description copied from interface: Trigger
The trigger method invoked when this trigger is added to the database. This is the very first trigger method that is invoked and it's invoked exactly once. If the database is replicated, it's invoked once per node on each node.

Specified by:
addTrigger in interface Trigger
Parameters:
txn - the active transaction associated with the operation. The argument is null if the database is not transactional.

removeTrigger

public void removeTrigger(Transaction txn)
Description copied from interface: Trigger
The trigger method invoked when this trigger is removed from the database, either as a result of opening the database with a different trigger configuration, or because the database it was associated with it has been removed. In the latter case, this trigger method follows the invocation of the Persistent#remove remove trigger. If the transaction is committed, there will be no subsequent trigger method invocations for this trigger.

Specified by:
removeTrigger in interface Trigger
Parameters:
txn - the active transaction associated with the operation. The argument is null if the database is not transactional.

open

public void open(Transaction txn,
                 Environment environment,
                 boolean isNew)
Description copied from interface: PersistentTrigger
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.

Specified by:
open in interface PersistentTrigger
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

public void close()
Description copied from interface: PersistentTrigger
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.

Specified by:
close in interface PersistentTrigger
See Also:
Database#close

remove

public void remove(Transaction txn)
Description copied from interface: PersistentTrigger
The trigger method invoked after the successful removal of a primary Database.

Specified by:
remove in interface PersistentTrigger
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

public void truncate(Transaction txn)
Description copied from interface: PersistentTrigger
The trigger method invoked after the successful truncation of a Database.

Specified by:
truncate in interface PersistentTrigger
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

public void rename(Transaction txn,
                   String newName)
Description copied from interface: PersistentTrigger
The trigger method invoked after the successful renaming of a primary Database.

Specified by:
rename in interface PersistentTrigger
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)

put

public void put(Transaction txn,
                DatabaseEntry key,
                DatabaseEntry oldData,
                DatabaseEntry newData)
Description copied from interface: Trigger
The trigger method invoked after a successful put, that is, one that actually results in a modification to the database.

If a new entry was inserted, oldData will be null and newData will be non-null. If an existing entry was updated, oldData and newData will be non-null.

Specified by:
put in interface Trigger
Parameters:
txn - the active transaction associated with the operation. The argument is null if the database is non-transactional.
key - the non-null primary key
oldData - the data before the change, or null if the record did not exist.
newData - the non-null data after the change

delete

public void delete(Transaction txn,
                   DatabaseEntry key,
                   DatabaseEntry oldData)
Description copied from interface: Trigger
The trigger method invoked after a successful delete, that is, one that actually resulted in a key/value pair being removed.

Truncating a database does not invoke this trigger; PersistentTrigger.truncate(com.sleepycat.je.Transaction) is invoked upon truncation.

Specified by:
delete in interface Trigger
Parameters:
txn - the active transaction associated with the operation. The argument is null if the database is non-transactional.
key - the non-null primary key
oldData - the non-null data that was associated with the deleted key

commit

public void commit(Transaction txn)
Description copied from interface: TransactionTrigger
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.

Specified by:
commit in interface TransactionTrigger
Parameters:
txn - the transaction that was committed

abort

public void abort(Transaction txn)
Description copied from interface: TransactionTrigger
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.

Specified by:
abort in interface TransactionTrigger
Parameters:
txn - the transaction that was aborted

repeatTransaction

public void repeatTransaction(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
Used to inform the application that the trigger method calls associated with the partial transaction will be repeated.

Specified by:
repeatTransaction in interface ReplicatedDatabaseTrigger
Parameters:
txn - the partial transaction

repeatAddTrigger

public void repeatAddTrigger(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when an addTrigger operation needs to be repeated.

Specified by:
repeatAddTrigger in interface ReplicatedDatabaseTrigger
See Also:
Trigger.addTrigger(com.sleepycat.je.Transaction)

repeatRemoveTrigger

public void repeatRemoveTrigger(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a removeTrigger operation needs to be repeated.

Specified by:
repeatRemoveTrigger in interface ReplicatedDatabaseTrigger
See Also:
Trigger.removeTrigger(com.sleepycat.je.Transaction)

repeatCreate

public void repeatCreate(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database create trigger needs to be repeated.

Specified by:
repeatCreate in interface ReplicatedDatabaseTrigger
See Also:
PersistentTrigger.open(com.sleepycat.je.Transaction, com.sleepycat.je.Environment, boolean)

repeatRemove

public void repeatRemove(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database remove trigger needs to be repeated.

Specified by:
repeatRemove in interface ReplicatedDatabaseTrigger
See Also:
PersistentTrigger.remove(com.sleepycat.je.Transaction)

repeatTruncate

public void repeatTruncate(Transaction txn)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database truncate trigger needs to be repeated.

Specified by:
repeatTruncate in interface ReplicatedDatabaseTrigger
See Also:
PersistentTrigger.truncate(com.sleepycat.je.Transaction)

repeatRename

public void repeatRename(Transaction txn,
                         String newName)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database rename trigger needs to be repeated.

Specified by:
repeatRename in interface ReplicatedDatabaseTrigger
See Also:
PersistentTrigger.rename(com.sleepycat.je.Transaction, java.lang.String)

repeatPut

public void repeatPut(Transaction txn,
                      DatabaseEntry key,
                      DatabaseEntry newData)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database put trigger needs to be repeated. Note that this method differs from the corresponding Trigger.put method in that it omits the oldData argument.

Specified by:
repeatPut in interface ReplicatedDatabaseTrigger
See Also:
Trigger.put(com.sleepycat.je.Transaction, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry)

repeatDelete

public void repeatDelete(Transaction txn,
                         DatabaseEntry key)
Description copied from interface: ReplicatedDatabaseTrigger
The trigger method invoked when a database delete trigger needs to be repeated. Note that this method differs from the corresponding Trigger.delete method in that it omits the oldData argument.

Specified by:
repeatDelete in interface ReplicatedDatabaseTrigger
See Also:
Trigger#remove


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