public interface WrappedTransaction extends AutoCloseable
WrappedFramedGraph
instance. Providers may
consider using AbstractTransaction
as a base implementation that provides default features for most of
these methods.
It is expected that this interface be implemented by providers in a ThreadLocal
fashion. In other words
transactions are bound to the current thread, which means that any graph operation executed by the thread occurs
in the context of that transaction and that there may only be one thread executing in a single transaction.
It is important to realize that this class is not a "transaction object". It is a class that holds transaction
related methods thus hiding them from the WrappedFramedGraph
interface. This object is not meant to be passed around
as a transactional context.Modifier and Type | Method and Description |
---|---|
void |
addTransactionListener(Consumer<org.apache.tinkerpop.gremlin.structure.Transaction.Status> listener)
Adds a listener that is called back with a status when a commit or rollback is successful.
|
void |
clearTransactionListeners()
Removes all transaction listeners.
|
void |
close() |
void |
commit()
Commits a transaction.
|
WrappedFramedGraph |
createThreadedTx()
Creates a transaction that can be executed across multiple threads.
|
org.apache.tinkerpop.gremlin.structure.Transaction |
getDelegate()
Returns the raw wrapped tinkerpop transaction.
|
WrappedFramedGraph<? extends org.apache.tinkerpop.gremlin.structure.Graph> |
getGraph()
Returns the parent graph for the transaction.
|
boolean |
isOpen()
Determines if a transaction is currently open.
|
void |
open()
Opens a transaction.
|
void |
readWrite()
An internal function that signals a read or a write has occurred - not meant to be called directly by end users.
|
void |
removeTransactionListener(Consumer<org.apache.tinkerpop.gremlin.structure.Transaction.Status> listener)
Removes a transaction listener.
|
void |
rollback()
Rolls back a transaction.
|
void open()
void commit()
void rollback()
WrappedFramedGraph createThreadedTx()
WrappedFramedGraph
returned from this
method is not meant to represent some form of child transaction that can be committed from this object.
A threaded transaction is a Graph
instance that has a transaction context that enables multiple
threads to collaborate on the same transaction. A standard transactional context tied to a WrappedFramedGraph
that supports transactions will typically bind a transaction to a single thread via ThreadLocal
.boolean isOpen()
void readWrite()
void close()
close
in interface AutoCloseable
void addTransactionListener(Consumer<org.apache.tinkerpop.gremlin.structure.Transaction.Status> listener)
listener
- the transaction listener to be addedvoid removeTransactionListener(Consumer<org.apache.tinkerpop.gremlin.structure.Transaction.Status> listener)
listener
- The listener to be removed.void clearTransactionListeners()
org.apache.tinkerpop.gremlin.structure.Transaction getDelegate()
WrappedFramedGraph<? extends org.apache.tinkerpop.gremlin.structure.Graph> getGraph()
Copyright © 2017 Syncleus. All rights reserved.