public final class HGTransaction extends Object implements HGStorageTransaction
Implements a transaction in HyperGraphDB.
Each transaction can carry an arbitrary set of attributes along with it. This is useful for attaching contextual information to transactions without intruding to otherwise simple APIs. When a transaction is committed or aborted, all attributes are removed.
Modifier and Type | Method and Description |
---|---|
void |
abort() |
void |
addAbortAction(Runnable r) |
void |
commit() |
protected Cons<VBoxBody<?>> |
doCommit()
Commit all "written boxes" and return a linked list of the newly attached bodies
to them.
|
<T> T |
getAttribute(Object key) |
Iterator<Object> |
getAttributeKeys() |
HGTransaction |
getParent()
Return the parent transaction of this transaction or
null is this is not a nested
transaction. |
HGStorageTransaction |
getStorageTransaction() |
HGTransaction |
getTopLevel()
Return the top-level transaction of which this is a nested transaction, or
this in case
this is already a top-level transaction. |
boolean |
isReadOnly() |
protected Cons<VBoxBody<?>> |
performValidCommit() |
void |
removeAttribute(Object key) |
void |
setAttribute(Object key,
Object value) |
protected boolean |
validateCommit()
A commit can proceed only if none of the values we've read during
the transaction has changed (i.e.
|
protected boolean validateCommit()
protected Cons<VBoxBody<?>> doCommit()
public HGStorageTransaction getStorageTransaction()
public void commit() throws HGTransactionException
commit
in interface HGStorageTransaction
HGTransactionException
public void abort() throws HGTransactionException
abort
in interface HGStorageTransaction
HGTransactionException
public <T> T getAttribute(Object key)
public void removeAttribute(Object key)
public boolean isReadOnly()
public void addAbortAction(Runnable r)
public HGTransaction getParent()
Return the parent transaction of this transaction or null
is this is not a nested
transaction.
public HGTransaction getTopLevel()
Return the top-level transaction of which this is a nested transaction, or this
in case
this is already a top-level transaction.
Copyright © 2015. All rights reserved.