public class DriverRemoteTransaction extends Object implements Transaction, RemoteConnection
Transaction implementation that is implemented with the Java driver. It is also a proxy for a
RemoteConnection that is bound to a session.
For users, starting a transaction with Transaction.begin() will produce a TraversalSource that 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. Calling commit() or
rollback() will also close the session and no additional traversal can be executed on the
TraversalSource. A fresh call to Transaction.begin() will be required to open a fresh session to work with.
The default behavior of close() is to commit the transaction.Transaction.CLOSE_BEHAVIOR, Transaction.Exceptions, Transaction.READ_WRITE_BEHAVIOR, Transaction.Status| Modifier and Type | Field and Description |
|---|---|
protected Consumer<Transaction> |
closeConsumer |
NO_OPGREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS| Constructor and Description |
|---|
DriverRemoteTransaction(DriverRemoteConnection sessionBasedConnection) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTransactionListener(Consumer<Transaction.Status> listener)
There is no support for remote transaction listeners.
|
<T extends TraversalSource> |
begin(Class<T> traversalSourceClass) |
void |
clearTransactionListeners()
There is no support for remote transaction listeners.
|
void |
close()
The default close behavior for this
Transaction implementation is to commit(). |
void |
commit() |
boolean |
isOpen() |
Transaction |
onClose(Consumer<Transaction> consumer) |
Transaction |
onReadWrite(Consumer<Transaction> consumer)
This
Transaction implementation is not auto-managed and therefore this method is not supported. |
void |
open()
By virtue of creating a
DriverRemoteTransaction, the transaction is considered open. |
void |
readWrite()
This
Transaction implementation is not auto-managed and therefore this method is not supported. |
void |
removeTransactionListener(Consumer<Transaction.Status> listener)
There is no support for remote transaction listeners.
|
void |
rollback() |
<E> CompletableFuture<RemoteTraversal<?,E>> |
submitAsync(Bytecode bytecode) |
Transaction |
tx()
It is not possible to have child transactions, therefore this method always returns
Transaction.NO_OP. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbegin, createThreadedTxfromprotected Consumer<Transaction> closeConsumer
public DriverRemoteTransaction(DriverRemoteConnection sessionBasedConnection)
public <T extends TraversalSource> T begin(Class<T> traversalSourceClass)
begin in interface Transactionpublic void open()
DriverRemoteTransaction, the transaction is considered open. There is no need
to call this method. Calling it when the transaction is closed will result in exception.open in interface Transactionpublic void commit()
commit in interface Transactionpublic void rollback()
rollback in interface Transactionpublic boolean isOpen()
isOpen in interface Transactionpublic void close()
Transaction implementation is to commit().close in interface AutoCloseableclose in interface Transactionpublic void readWrite()
Transaction implementation is not auto-managed and therefore this method is not supported.readWrite in interface Transactionpublic Transaction onReadWrite(Consumer<Transaction> consumer)
Transaction implementation is not auto-managed and therefore this method is not supported.onReadWrite in interface Transactionpublic Transaction onClose(Consumer<Transaction> consumer)
onClose in interface Transactionpublic void addTransactionListener(Consumer<Transaction.Status> listener)
addTransactionListener in interface Transactionpublic void removeTransactionListener(Consumer<Transaction.Status> listener)
removeTransactionListener in interface Transactionpublic void clearTransactionListeners()
clearTransactionListeners in interface Transactionpublic Transaction tx()
Transaction.NO_OP.tx in interface RemoteConnectionpublic <E> CompletableFuture<RemoteTraversal<?,E>> submitAsync(Bytecode bytecode) throws RemoteConnectionException
submitAsync in interface RemoteConnectionRemoteConnectionExceptionCopyright © 2013–2022 Apache Software Foundation. All rights reserved.