T
- the type of object communicated from a successful
beforeCommit(TransactionData)
to afterCommit(TransactionData, Object)
.public static class TransactionEventHandler.Adapter<T> extends Object implements TransactionEventHandler<T>
TransactionEventHandler
TransactionEventHandler.Adapter<T>
Constructor and Description |
---|
Adapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterCommit(TransactionData data,
T state)
Invoked after the transaction has been committed successfully.
|
void |
afterRollback(TransactionData data,
T state)
Invoked after the transaction has been rolled back if committing the
transaction failed for some reason.
|
T |
beforeCommit(TransactionData data)
Invoked when a transaction that has changes accessible via
TransactionData
is about to be committed. |
public T beforeCommit(TransactionData data) throws Exception
TransactionEventHandler
TransactionData
is about to be committed.
If this method throws an exception the transaction will be rolled back
and a TransactionFailureException
will be thrown from
Transaction.close()
.
The transaction is still open when this method is invoked, making it
possible to perform mutating operations in this method. This is however
highly discouraged since changes made in this method are not guaranteed to be
visible by this or other TransactionEventHandler
s.beforeCommit
in interface TransactionEventHandler<T>
data
- the changes that will be committed in this transaction.null
) that will be passed on to
TransactionEventHandler.afterCommit(TransactionData, Object)
or
TransactionEventHandler.afterRollback(TransactionData, Object)
of this object.Exception
- to indicate that the transaction should be rolled back.public void afterCommit(TransactionData data, T state)
TransactionEventHandler
TransactionData
being passed in to this method is guaranteed
to first have been called with TransactionEventHandler.beforeCommit(TransactionData)
.
At the point of calling this method the transaction have been closed
and so accessing data outside that of what the TransactionData
can provide will require a new transaction to be opened.afterCommit
in interface TransactionEventHandler<T>
data
- the changes that were committed in this transaction.state
- the object returned by
TransactionEventHandler.beforeCommit(TransactionData)
.public void afterRollback(TransactionData data, T state)
TransactionEventHandler
TransactionData
being passed in to this method is guaranteed
to first have been called with TransactionEventHandler.beforeCommit(TransactionData)
.
At the point of calling this method the transaction have been closed
and so accessing data outside that of what the TransactionData
can provide will require a new transaction to be opened.afterRollback
in interface TransactionEventHandler<T>
data
- the changes that were attempted to be committed in this transaction.state
- the object returned by
TransactionEventHandler.beforeCommit(TransactionData)
.Copyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.