T - The type of a state object that the module can use to
pass information from the beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData)
method to the afterCommit(Object) method.public interface TxDrivenModule<T> extends RuntimeModule
RuntimeModule module performing some useful work based on about-to-be-committed transaction data.| Modifier and Type | Method and Description |
|---|---|
void |
afterCommit(T state)
Perform the core business logic of this module after a transaction commits.
|
void |
afterRollback(T state)
Cleanup if needed after a transaction rolled back.
|
T |
beforeCommit(ImprovedTransactionData transactionData)
Perform the core business logic of this module before a transaction commits.
|
TxDrivenModuleConfiguration |
getConfiguration()
Return the configuration of this module.
|
void |
initialize(org.neo4j.graphdb.GraphDatabaseService database)
Initialize this module.
|
void |
reinitialize(org.neo4j.graphdb.GraphDatabaseService database,
TxDrivenModuleMetadata oldMetadata)
Re-initialize this module.
|
void |
start(org.neo4j.graphdb.GraphDatabaseService database)
Start the module.
|
getId, shutdownT beforeCommit(ImprovedTransactionData transactionData) throws DeliberateTransactionRollbackException
getConfiguration() that the module isn't interested in this transaction, this method will
not be called.
Note that in case this method throws RuntimeException (including NeedsInitializationException),
afterCommit(Object) will be called with a null argument.
Note that in case this method throws DeliberateTransactionRollbackException, afterRollback(Object)
will be called with a null argument.transactionData - data about the soon-to-be-committed transaction. It is already filtered based on getConfiguration().null) that will be passed on to afterCommit(Object) of this object. Only return null if you do nothing in afterCommit(Object).NeedsInitializationException - if it detects data is out of sync. initialize(org.neo4j.graphdb.GraphDatabaseService) will be called next
time the GraphAwareRuntime is started. Until then, the module
should perform on best-effort basis.DeliberateTransactionRollbackException - if the module wants to prevent the transaction from committing.void afterCommit(T state)
state - returned by beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData). Will
be null if beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData)
threw an exception but the transaction still committed. This is the case for all exceptions except DeliberateTransactionRollbackException.void afterRollback(T state)
beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData)
method was called.state - returned by beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData). Will
be null if it is this module that caused the rollback by throwing DeliberateTransactionRollbackException.
Will also be null if beforeCommit(com.graphaware.tx.event.improved.api.ImprovedTransactionData) threw
a non-rollback-causing exception, but some other module caused rollback after that.TxDrivenModuleConfiguration getConfiguration()
TxDrivenModuleConfiguration implementation. Use NullTxDrivenModuleConfiguration
if this module needs no configuration.void start(org.neo4j.graphdb.GraphDatabaseService database)
database - to start this module against.void initialize(org.neo4j.graphdb.GraphDatabaseService database)
database - to initialize this module for.void reinitialize(org.neo4j.graphdb.GraphDatabaseService database,
TxDrivenModuleMetadata oldMetadata)
database - to re-initialize this module for.oldMetadata - metadata stored for this module from its previous run. Can be null in case metadata
was corrupt or there was no metadata.Copyright © 2013-2016–2018 Graph Aware Limited. All rights reserved.