Package io.objectbox
Class Transaction
java.lang.Object
io.objectbox.Transaction
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()(package private) voidvoidclose()voidcommit()void<T> Cursor<T> createCursor(Class<T> entityClass) protected voidfinalize()Explicitly callclose()instead to avoid expensive finalization.getStore()(package private) longbooleanisActive()booleanisClosed()booleanIndicates if data returned from this transaction may be obsolete (another write TX was committed after this transaction was started).booleanboolean(package private) voidnativeAbort(long transaction) (package private) int[]nativeCommit(long transaction) (package private) longnativeCreateCursor(long transaction, String entityName, Class<?> entityClass) (package private) longnativeCreateKeyValueCursor(long transaction) (package private) voidnativeDestroy(long transaction) (package private) booleannativeIsActive(long transaction) (package private) booleannativeIsOwnerThread(long transaction) (package private) booleannativeIsReadOnly(long transaction) (package private) booleannativeIsRecycled(long transaction) (package private) voidnativeRecycle(long transaction) (package private) voidnativeRenew(long transaction) (package private) voidnativeReset(long transaction) voidrecycle()For read transactions, this releases important native resources that hold on versions of potential old data.voidrenew()Renews a previously recycled transaction (seerecycle()).voidreset()Will throw if Cursors are still active for this TX.toString()
-
Field Details
-
TRACK_CREATION_STACK
May be set by tests -
transaction
private final long transaction -
store
-
readOnly
private final boolean readOnly -
creationThrowable
-
initialCommitCount
private int initialCommitCount -
closed
private volatile boolean closedvolatile because finalizer thread may interfere with "one thread, one TX" rule
-
-
Constructor Details
-
Transaction
-
-
Method Details
-
nativeDestroy
void nativeDestroy(long transaction) -
nativeCommit
int[] nativeCommit(long transaction) -
nativeAbort
void nativeAbort(long transaction) -
nativeReset
void nativeReset(long transaction) -
nativeRecycle
void nativeRecycle(long transaction) -
nativeRenew
void nativeRenew(long transaction) -
nativeCreateKeyValueCursor
long nativeCreateKeyValueCursor(long transaction) -
nativeCreateCursor
-
nativeIsActive
boolean nativeIsActive(long transaction) -
nativeIsOwnerThread
boolean nativeIsOwnerThread(long transaction) -
nativeIsRecycled
boolean nativeIsRecycled(long transaction) -
nativeIsReadOnly
boolean nativeIsReadOnly(long transaction) -
finalize
Explicitly callclose()instead to avoid expensive finalization. -
checkOpen
void checkOpen() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
commit
public void commit() -
commitAndClose
public void commitAndClose() -
abort
public void abort() -
reset
Will throw if Cursors are still active for this TX. Efficient for read transactions. -
recycle
public void recycle()For read transactions, this releases important native resources that hold on versions of potential old data. To continue, userenew(). -
renew
public void renew()Renews a previously recycled transaction (seerecycle()). Efficient for read transactions. -
createKeyValueCursor
-
createCursor
-
getStore
-
isActive
public boolean isActive() -
isRecycled
public boolean isRecycled() -
isClosed
public boolean isClosed() -
isReadOnly
public boolean isReadOnly() -
isObsolete
public boolean isObsolete()Indicates if data returned from this transaction may be obsolete (another write TX was committed after this transaction was started). -
internalHandle
-
toString
-