Class DriverRemoteTransaction
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTransaction
-
- All Implemented Interfaces:
AutoCloseable,RemoteConnection,Transaction
public class DriverRemoteTransaction extends Object implements Transaction, RemoteConnection
A remoteTransactionimplementation that is implemented with the Java driver. It is also a proxy for aRemoteConnectionthat is bound to a session. For users, starting a transaction withTransaction.begin()will produce aTraversalSourcethat can be used across multiple threads sending the bytecode based requests to a remote session. It is worth noting that the session will process these requests in a serial fashion and not in parallel. Callingcommit()orrollback()will also close the session and no additional traversal can be executed on theTraversalSource. A fresh call toTransaction.begin()will be required to open a fresh session to work with. The default behavior ofclose()is to commit the transaction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Transaction
Transaction.CLOSE_BEHAVIOR, Transaction.Exceptions, Transaction.READ_WRITE_BEHAVIOR, Transaction.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected Consumer<Transaction>closeConsumer-
Fields inherited from interface org.apache.tinkerpop.gremlin.process.remote.RemoteConnection
GREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS
-
Fields inherited from interface org.apache.tinkerpop.gremlin.structure.Transaction
NO_OP
-
-
Constructor Summary
Constructors Constructor Description DriverRemoteTransaction(DriverRemoteConnection sessionBasedConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTransactionListener(Consumer<Transaction.Status> listener)There is no support for remote transaction listeners.<T extends TraversalSource>
Tbegin(Class<T> traversalSourceClass)voidclearTransactionListeners()There is no support for remote transaction listeners.voidclose()The default close behavior for thisTransactionimplementation is tocommit().voidcommit()booleanisOpen()TransactiononClose(Consumer<Transaction> consumer)TransactiononReadWrite(Consumer<Transaction> consumer)ThisTransactionimplementation is not auto-managed and therefore this method is not supported.voidopen()By virtue of creating aDriverRemoteTransaction, the transaction is considered open.voidreadWrite()ThisTransactionimplementation is not auto-managed and therefore this method is not supported.voidremoveTransactionListener(Consumer<Transaction.Status> listener)There is no support for remote transaction listeners.voidrollback()<E> CompletableFuture<RemoteTraversal<?,E>>submitAsync(Bytecode bytecode)Transactiontx()It is not possible to have child transactions, therefore this method always returnsTransaction.NO_OP.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.structure.Transaction
begin, createThreadedTx
-
-
-
-
Field Detail
-
closeConsumer
protected Consumer<Transaction> closeConsumer
-
-
Constructor Detail
-
DriverRemoteTransaction
public DriverRemoteTransaction(DriverRemoteConnection sessionBasedConnection)
-
-
Method Detail
-
begin
public <T extends TraversalSource> T begin(Class<T> traversalSourceClass)
- Specified by:
beginin interfaceTransaction
-
open
public void open()
By virtue of creating aDriverRemoteTransaction, the transaction is considered open. There is no need to call this method. Calling it when the transaction is closed will result in exception.- Specified by:
openin interfaceTransaction
-
commit
public void commit()
- Specified by:
commitin interfaceTransaction
-
rollback
public void rollback()
- Specified by:
rollbackin interfaceTransaction
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceTransaction
-
close
public void close()
The default close behavior for thisTransactionimplementation is tocommit().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTransaction
-
readWrite
public void readWrite()
ThisTransactionimplementation is not auto-managed and therefore this method is not supported.- Specified by:
readWritein interfaceTransaction
-
onReadWrite
public Transaction onReadWrite(Consumer<Transaction> consumer)
ThisTransactionimplementation is not auto-managed and therefore this method is not supported.- Specified by:
onReadWritein interfaceTransaction
-
onClose
public Transaction onClose(Consumer<Transaction> consumer)
- Specified by:
onClosein interfaceTransaction
-
addTransactionListener
public void addTransactionListener(Consumer<Transaction.Status> listener)
There is no support for remote transaction listeners.- Specified by:
addTransactionListenerin interfaceTransaction
-
removeTransactionListener
public void removeTransactionListener(Consumer<Transaction.Status> listener)
There is no support for remote transaction listeners.- Specified by:
removeTransactionListenerin interfaceTransaction
-
clearTransactionListeners
public void clearTransactionListeners()
There is no support for remote transaction listeners.- Specified by:
clearTransactionListenersin interfaceTransaction
-
tx
public Transaction tx()
It is not possible to have child transactions, therefore this method always returnsTransaction.NO_OP.- Specified by:
txin interfaceRemoteConnection
-
submitAsync
public <E> CompletableFuture<RemoteTraversal<?,E>> submitAsync(Bytecode bytecode) throws RemoteConnectionException
- Specified by:
submitAsyncin interfaceRemoteConnection- Throws:
RemoteConnectionException
-
-