public override TransactionHandlerState BeforeCommit(ReadableTransactionState state, KernelTransaction transaction, StorageReader storageReader) { // The iterator grabs a snapshot of our list of handlers IEnumerator <TransactionEventHandler> handlers = _transactionEventHandlers.GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: if (!handlers.hasNext()) { // Use 'null' as a signal that no event handlers were registered at beforeCommit time return(null); } TransactionData txData = state == null ? EMPTY_DATA : new TxStateTransactionDataSnapshot(state, _proxySpi, storageReader, transaction); TransactionHandlerState handlerStates = new TransactionHandlerState(txData); while (handlers.MoveNext()) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.graphdb.event.TransactionEventHandler<?> handler = handlers.Current; TransactionEventHandler <object> handler = handlers.Current; try { handlerStates.Add(handler).State = handler.BeforeCommit(txData); } catch (Exception t) { handlerStates.Failed(t); } } return(handlerStates); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @SuppressWarnings("unchecked") public void afterRollback(org.neo4j.storageengine.api.txstate.ReadableTransactionState state, org.neo4j.kernel.api.KernelTransaction transaction, TransactionHandlerState handlerState) public override void AfterRollback(ReadableTransactionState state, KernelTransaction transaction, TransactionHandlerState handlerState) { if (handlerState == null) { // For legacy reasons, we don't call transaction handlers on implicit rollback. return; } foreach (HandlerAndState handlerAndState in handlerState.States) { handlerAndState.Handler.afterRollback(handlerState.TxData, handlerAndState.StateConflict); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @SuppressWarnings("unchecked") public void afterCommit(org.neo4j.storageengine.api.txstate.ReadableTransactionState state, org.neo4j.kernel.api.KernelTransaction transaction, TransactionHandlerState handlerState) public override void AfterCommit(ReadableTransactionState state, KernelTransaction transaction, TransactionHandlerState handlerState) { if (handlerState == null) { // As per beforeCommit, 'null' means no handlers were registered in time for this transaction to // observe them. return; } foreach (HandlerAndState handlerAndState in handlerState.States) { handlerAndState.Handler.afterCommit(handlerState.TxData, handlerAndState.StateConflict); } }