-
Notifications
You must be signed in to change notification settings - Fork 0
Graph Transactions
A Graph
that implements the TransactionalGraph
or ThreadedTransactionalGraph
interfaces must natively support transaction handling.
A TransactionalGraph
has the following methods.
public void startTransaction();
public void stopTransaction(Conclusion conclusion);
When a transaction is started, all the subsequent mutation operations in the transaction occur within a transaction context. When the transaction is successfully stopped, those mutations operations are persisted and visible to other contexts interacting with the graph. If a transaction is failed, then the mutation operations are “rolled back” to when the transaction was started.
To facilitate ease of use, a call to startTransaction()
is not required. If a mutating operation is evaluated and a transaction has not been started, then a transaction is automatically started. However, it is up to the user to stopTransaction(Conclusion conclusion)
or else they run the risk of a OutOfMemoryException
if too many mutations have occurred. Finally, note that a TransactionalGraph.shutdown()
will automatically successfully commit any open transaction.
A ThreadedTransactionalGraph
extends TransactionalGraph
with a single method.
public TransactionalGraph startThreadTransaction()