- All Implemented Interfaces:
AsyncQueryRunner,AsyncTransaction
-
Constructor Summary
ConstructorsConstructorDescriptionInternalAsyncTransaction(UnmanagedTransaction tx, DriverObservationProvider observationProvider, Observation parentObservation) -
Method Summary
Modifier and TypeMethodDescriptionClose the transaction.Commit this transaction in asynchronous fashion.booleanisOpen()Determine if transaction is open.Rollback this transaction in asynchronous fashion.Run a query asynchronously and return aCompletionStagewith a result cursor.Methods inherited from class org.neo4j.driver.internal.async.AsyncAbstractQueryRunner
runAsync, runAsync, runAsync, runAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.neo4j.driver.async.AsyncQueryRunner
runAsync, runAsync, runAsync, runAsync
-
Constructor Details
-
InternalAsyncTransaction
public InternalAsyncTransaction(UnmanagedTransaction tx, DriverObservationProvider observationProvider, Observation parentObservation)
-
-
Method Details
-
commitAsync
Description copied from interface:AsyncTransactionCommit this transaction in asynchronous fashion. This operation is typically executed as part of theCompletionStagechain that starts with a transaction. There is no need to close transaction after calling this method. Transaction object should not be used after calling this method.Returned stage can be completed by an IO thread which should never block. Otherwise IO operations on this and potentially other network connections might deadlock. Please do not chain blocking operations like
CompletableFuture.get()on the returned stage. Consider using asynchronous calls throughout the chain or offloading blocking operation to a differentExecutor. This can be done using methods with "Async" suffix likeCompletionStage.thenApplyAsync(Function)orCompletionStage.thenApplyAsync(Function, Executor).- Specified by:
commitAsyncin interfaceAsyncTransaction- Returns:
- new
CompletionStagethat gets completed withnullwhen commit is successful. Stage can be completed exceptionally when commit fails.
-
rollbackAsync
Description copied from interface:AsyncTransactionRollback this transaction in asynchronous fashion. This operation is typically executed as part of theCompletionStagechain that starts with a transaction. There is no need to close transaction after calling this method. Transaction object should not be used after calling this method.Returned stage can be completed by an IO thread which should never block. Otherwise IO operations on this and potentially other network connections might deadlock. Please do not chain blocking operations like
CompletableFuture.get()on the returned stage. Consider using asynchronous calls throughout the chain or offloading blocking operation to a differentExecutor. This can be done using methods with "Async" suffix likeCompletionStage.thenApplyAsync(Function)orCompletionStage.thenApplyAsync(Function, Executor).- Specified by:
rollbackAsyncin interfaceAsyncTransaction- Returns:
- new
CompletionStagethat gets completed withnullwhen rollback is successful. Stage can be completed exceptionally when rollback fails.
-
closeAsync
Description copied from interface:AsyncTransactionClose the transaction. If the transaction has beencommittedorrolled back, the close is optional and no operation is performed. Otherwise, the transaction will be rolled back by default by this method.- Specified by:
closeAsyncin interfaceAsyncTransaction- Returns:
- new
CompletionStagethat gets completed withnullwhen close is successful, otherwise it gets completed exceptionally.
-
isOpenAsync
Description copied from interface:AsyncTransactionDetermine if transaction is open.- Specified by:
isOpenAsyncin interfaceAsyncTransaction- Returns:
- a
CompletionStagecompleted withtrueif transaction is open andfalseotherwise.
-
runAsync
Description copied from interface:AsyncQueryRunnerRun a query asynchronously and return aCompletionStagewith a result cursor.Example
It is not allowed to chain blocking operations on the returnedQuery query = new Query( "MATCH (n) WHERE n.name = $myNameParam RETURN n.age" ); CompletionStage<ResultCursor> cursorStage = session.runAsync(query);CompletionStage. See class javadoc for more information.- Specified by:
runAsyncin interfaceAsyncQueryRunner- Parameters:
query- a Neo4j query- Returns:
- new
CompletionStagethat gets completed with a result cursor when query execution is successful. Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
-
isOpen
public boolean isOpen()
-