use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class MutableConnectionStateTest method shouldThrowErrorWhenSetStatementProcessorAndThereIsPendingTerminationError.
@Test
void shouldThrowErrorWhenSetStatementProcessorAndThereIsPendingTerminationError() throws Throwable {
state.setPendingTerminationNotice(Invalid);
StatementProcessor processor = mock(StatementProcessor.class);
TransactionTerminatedException error = assertThrows(TransactionTerminatedException.class, () -> state.setStatementProcessor(processor));
assertThat(error.status()).isEqualTo(Invalid);
// The second set shall be fine
state.setStatementProcessor(processor);
assertThat(state.getStatementProcessor()).isEqualTo(processor);
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class TransactionReadyState method processRollbackMessage.
private BoltStateMachineState processRollbackMessage(StateMachineContext context) throws KernelException {
StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
statementProcessor.rollbackTransaction();
return readyState;
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class TransactionReadyState method processCommitMessage.
private BoltStateMachineState processCommitMessage(StateMachineContext context) throws KernelException {
StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
Bookmark bookmark = statementProcessor.commitTransaction();
bookmark.attachTo(context.connectionState());
return readyState;
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class ReadyState method processRunMessage.
private BoltStateMachineState processRunMessage(RunMessage message, StateMachineContext context) throws Exception {
long start = context.clock().millis();
StatementProcessor statementProcessor = getStatementProcessor(message, context);
StatementMetadata statementMetadata = statementProcessor.run(message.statement(), message.params(), message.bookmarks(), message.transactionTimeout(), message.getAccessMode(), message.transactionMetadata());
long end = context.clock().millis();
context.connectionState().onMetadata(FIELDS_KEY, stringArray(statementMetadata.fieldNames()));
context.connectionState().onMetadata(FIRST_RECORD_AVAILABLE_KEY, Values.longValue(end - start));
return streamingState;
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class InTransactionState method processCommitMessage.
private BoltStateMachineState processCommitMessage(StateMachineContext context) throws KernelException {
StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
Bookmark bookmark = statementProcessor.commitTransaction();
bookmark.attachTo(context.connectionState());
return readyState;
}
Aggregations