|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.TxEngine.Tx
public class TxEngine.Tx
| Field Summary | |
|---|---|
protected boolean |
closed
|
protected LongConcurrentHashMap<Fun.Tuple2> |
mod
|
protected LongConcurrentHashMap |
old
|
protected Reference<TxEngine.Tx> |
ref
|
protected Collection<Long> |
usedPreallocatedRecids
|
| Fields inherited from interface org.mapdb.Engine |
|---|
CATALOG_RECID, CHECK_RECORD, CLASS_INFO_RECID, LAST_RESERVED_RECID |
| Constructor Summary | |
|---|---|
TxEngine.Tx()
|
|
| Method Summary | ||
|---|---|---|
boolean |
canRollback()
|
|
boolean |
canSnapshot()
|
|
void |
clearCache()
clears any underlying cache |
|
void |
close()
Close store/cache. |
|
void |
closeListenerRegister(Runnable closeListener)
|
|
void |
closeListenerUnregister(Runnable closeListener)
|
|
void |
commit()
Makes all changes made since the previous commit/rollback permanent. |
|
void |
compact()
|
|
|
compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
Updates existing record in atomic (Compare And Swap) manner. |
|
|
delete(long recid,
Serializer<A> serializer)
Remove existing record from store/cache Recid must be a number returned by 'put' method. |
|
|
get(long recid,
Serializer<A> serializer)
Get existing record. |
|
SerializerPojo |
getSerializerPojo()
Returns default serializer associated with this engine. |
|
Engine |
getWrappedEngine()
|
|
boolean |
isClosed()
Checks whether Engine was closed. |
|
boolean |
isReadOnly()
Check if you can write into this Engine. |
|
long |
preallocate()
Preallocates recid for not yet created record. |
|
void |
preallocate(long[] recids)
Preallocates recids for not yet created record. |
|
|
put(A value,
Serializer<A> serializer)
Insert new record. |
|
void |
rollback()
Undoes all changes made in the current transaction. |
|
Engine |
snapshot()
Returns read-only snapshot of data in Engine. |
|
|
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected LongConcurrentHashMap old
protected LongConcurrentHashMap<Fun.Tuple2> mod
protected Collection<Long> usedPreallocatedRecids
protected final Reference<TxEngine.Tx> ref
protected boolean closed
| Constructor Detail |
|---|
public TxEngine.Tx()
| Method Detail |
|---|
public long preallocate()
Engine
preallocate in interface Enginepublic void preallocate(long[] recids)
Engine
preallocate in interface Enginerecids - array to put result into
public <A> long put(A value,
Serializer<A> serializer)
Engine
put in interface Enginevalue - records to be addedserializer - used to convert record into/from binary form
public <A> A get(long recid,
Serializer<A> serializer)
Engine
get in interface Enginerecid - (record identifier) under which record was persistedserializer - used to deserialize record from binary form
public <A> void update(long recid,
A value,
Serializer<A> serializer)
Engine
update in interface Enginerecid - (record identifier) under which record was persisted.value - new record value to be storedserializer - used to serialize record into binary form
public <A> boolean compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
EngineoldValue==expectedOldValue when old value is found in instance cacheoldValue using serializer and checking oldValue.equals(expectedOldValue)expectedOldValue using serializer and comparing binary array with already serialized oldValue
compareAndSwap in interface Enginerecid - (record identifier) under which record was persisted.expectedOldValue - old value to be compared with existing recordnewValue - to be written if values are matchingserializer - used to serialize record into binary form
public <A> void delete(long recid,
Serializer<A> serializer)
Engine
delete in interface Enginerecid - (record identifier) under which was record persistedserializer - which may be used in some circumstances to deserialize and store old objectpublic void close()
EngineNullPointerException
There is an configuration option DBMaker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.
close in interface Enginepublic boolean isClosed()
Engine
isClosed in interface Enginepublic void commit()
Engine
commit in interface Engine
public void rollback()
throws UnsupportedOperationException
EngineUnsupportedOperationException.
rollback in interface EngineUnsupportedOperationException - if transactions are disabledpublic boolean isReadOnly()
Engine
isReadOnly in interface Enginepublic boolean canRollback()
canRollback in interface Enginepublic boolean canSnapshot()
canSnapshot in interface Engine
public Engine snapshot()
throws UnsupportedOperationException
Engine
snapshot in interface EngineUnsupportedOperationException - if snapshots are not supported/enabledEngineWrapper.canSnapshot()public void clearCache()
Engine
clearCache in interface Enginepublic void compact()
compact in interface Enginepublic SerializerPojo getSerializerPojo()
Engine
getSerializerPojo in interface Enginepublic void closeListenerRegister(Runnable closeListener)
closeListenerRegister in interface Enginepublic void closeListenerUnregister(Runnable closeListener)
closeListenerUnregister in interface Enginepublic Engine getWrappedEngine()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||