public interface Tx extends WrappedTransaction
Tx
is an extended flavor of the WrappedTransaction
. This interface provides methods to store and retrieve transaction references. This is
useful if you want to access a running transaction without passing along the transaction object in your implementation. Additionally this interface provides
the success()
and failure()
methods which can be used within the close()
method in order to rollback or commit the transaction
according to the state of the flag which is set using these methods. The AbstractTx
class contains an abstract implementation of this mechanism.Modifier and Type | Field and Description |
---|---|
static ThreadLocal<Tx> |
threadLocalGraph
Thread local that is used to store references to the used graph.
|
Modifier and Type | Method and Description |
---|---|
default <T> T |
addVertex(Class<T> kind)
Add new isolated vertex to the graph.
|
void |
close()
Invoke rollback or commit when closing the autoclosable.
|
void |
failure()
Mark the transaction as failed.
|
static Tx |
getActive()
Return the current active graph.
|
static void |
setActive(Tx tx)
Set the nested active transaction for the current thread.
|
void |
success()
Mark the transaction as succeeded.
|
addTransactionListener, clearTransactionListeners, commit, createThreadedTx, getDelegate, getGraph, isOpen, open, readWrite, removeTransactionListener, rollback
static final ThreadLocal<Tx> threadLocalGraph
static void setActive(Tx tx)
tx
- Transactionstatic Tx getActive()
void success()
void failure()
void close()
close
in interface AutoCloseable
close
in interface WrappedTransaction
default <T> T addVertex(Class<T> kind)
T
- The type used to frame the element.kind
- The kind of the vertexCopyright © 2017 Syncleus. All rights reserved.