Search in sources :

Example 1 with ListenerState

use of org.neo4j.kernel.internal.event.TransactionListenersState.ListenerState in project neo4j by neo4j.

the class DatabaseTransactionEventListeners method afterCommit.

public void afterCommit(TransactionListenersState listeners) {
    if (listeners == null) {
        // observe them.
        return;
    }
    TransactionData txData = listeners.getTxData();
    try {
        for (ListenerState listenerState : listeners.getStates()) {
            TransactionEventListener listener = listenerState.getListener();
            listener.afterCommit(txData, listenerState.getState(), databaseFacade);
        }
    } finally {
        if (txData instanceof TxStateTransactionDataSnapshot) {
            ((TxStateTransactionDataSnapshot) txData).close();
        }
    // else if could be EMPTY_DATA as well, and we don't want the user-facing TransactionData interface to have close() on it
    }
}
Also used : ListenerState(org.neo4j.kernel.internal.event.TransactionListenersState.ListenerState) TransactionData(org.neo4j.graphdb.event.TransactionData) TransactionEventListener(org.neo4j.graphdb.event.TransactionEventListener)

Example 2 with ListenerState

use of org.neo4j.kernel.internal.event.TransactionListenersState.ListenerState in project neo4j by neo4j.

the class DatabaseTransactionEventListeners method afterRollback.

public void afterRollback(TransactionListenersState listenersState) {
    if (listenersState == null) {
        // For legacy reasons, we don't call transaction listeners on implicit rollback.
        return;
    }
    TransactionData txData = listenersState.getTxData();
    for (ListenerState listenerState : listenersState.getStates()) {
        TransactionEventListener listener = listenerState.getListener();
        listener.afterRollback(txData, listenerState.getState(), databaseFacade);
    }
}
Also used : ListenerState(org.neo4j.kernel.internal.event.TransactionListenersState.ListenerState) TransactionData(org.neo4j.graphdb.event.TransactionData) TransactionEventListener(org.neo4j.graphdb.event.TransactionEventListener)

Aggregations

TransactionData (org.neo4j.graphdb.event.TransactionData)2 TransactionEventListener (org.neo4j.graphdb.event.TransactionEventListener)2 ListenerState (org.neo4j.kernel.internal.event.TransactionListenersState.ListenerState)2