use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class StackingQueryRegistrationOperations method startQueryExecution.
@Override
public ExecutingQuery startQueryExecution(KernelStatement statement, ClientConnectionInfo clientConnection, String queryText, Map<String, Object> queryParameters) {
long queryId = lastQueryId.incrementAndGet();
Thread thread = Thread.currentThread();
ExecutingQuery executingQuery = new ExecutingQuery(queryId, clientConnection, statement.username(), queryText, queryParameters, statement.getTransaction().getMetaData(), statement.locks()::activeLockCount, thread, clock, CpuClock.CPU_CLOCK);
registerExecutingQuery(statement, executingQuery);
return executingQuery;
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class ExecutingQueryListTest method removingQueryInTheMiddleKeepsOrder.
@Test
public void removingQueryInTheMiddleKeepsOrder() {
// Given
ExecutingQuery query1 = createExecutingQuery(1, "query1");
ExecutingQuery query2 = createExecutingQuery(2, "query2");
ExecutingQuery query3 = createExecutingQuery(3, "query3");
ExecutingQuery query4 = createExecutingQuery(4, "query4");
ExecutingQuery query5 = createExecutingQuery(5, "query5");
ExecutingQueryList list = ExecutingQueryList.EMPTY.push(query1).push(query2).push(query3).push(query4).push(query5);
// When
List<ExecutingQuery> result = list.remove(query3).queries().collect(Collectors.toList());
// Then
assertThat(result, equalTo(asList(query5, query4, query2, query1)));
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class ExecutingQueryListTest method shouldNotChangeAListWhenRemovingAQueryThatIsNotInTheList.
@Test
public void shouldNotChangeAListWhenRemovingAQueryThatIsNotInTheList() throws Exception {
// given
ExecutingQuery query1 = createExecutingQuery(1, "query1");
ExecutingQuery query2 = createExecutingQuery(2, "query2");
ExecutingQueryList list = ExecutingQueryList.EMPTY.push(query1);
// when
ExecutingQueryList result = list.remove(query2);
// then
assertThat(result, equalTo(list));
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class Neo4jTransactionalContextFactory method create.
@Deprecated
public static TransactionalContextFactory create(GraphDatabaseQueryService queryService, PropertyContainerLocker locker) {
DependencyResolver resolver = queryService.getDependencyResolver();
ThreadToStatementContextBridge txBridge = resolver.resolveDependency(ThreadToStatementContextBridge.class);
Guard guard = resolver.resolveDependency(Guard.class);
Neo4jTransactionalContext.Creator contextCreator = (Supplier<Statement> statementSupplier, InternalTransaction tx, Statement initialStatement, ExecutingQuery executingQuery) -> new Neo4jTransactionalContext(queryService, statementSupplier, guard, txBridge, locker, tx, initialStatement, executingQuery);
return new Neo4jTransactionalContextFactory(txBridge, contextCreator);
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class Neo4jTransactionalContextFactory method newContext.
@Override
public final Neo4jTransactionalContext newContext(ClientConnectionInfo clientConnection, InternalTransaction tx, String queryText, Map<String, Object> queryParameters) {
Statement initialStatement = statementSupplier.get();
ClientConnectionInfo connectionWithUserName = clientConnection.withUsername(tx.securityContext().subject().username());
ExecutingQuery executingQuery = initialStatement.queryRegistration().startQueryExecution(connectionWithUserName, queryText, queryParameters);
return contextCreator.create(statementSupplier, tx, initialStatement, executingQuery);
}
Aggregations