Interface OTransaction
- All Known Subinterfaces:
OTransactionInternal
- All Known Implementing Classes:
OTransactionAbstract,OTransactionNoTx,OTransactionOptimistic,OTransactionOptimisticClient,OTransactionOptimisticDistributed,OTransactionOptimisticProxy,OTransactionOptimisticServer
public interface OTransaction
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangedDocument(ODocument document) Adds the given document to a set of changed documents known to this transaction.voidaddIndexEntry(OIndex index, String indexName, OTransactionIndexChanges.OPERATION operation, Object key, OIdentifiable value) Adds the transactional index entry in this transaction.intvoidbegin()voidclose()voidcommit()voidcommit(boolean force) voiddeleteRecord(ORecord record) Deletes the given record in this transaction.default intgetCustomData(String name) Obtains the custom value by its name stored in the context of this transaction.intintgetId()getIndexChanges(String indexName) Obtains the index changes done in the context of this transaction.getIndexChangesInternal(String indexName) Does the same thing asgetIndexChanges(String), but handles remote storages in a special way.Returns the current isolation level.getNewRecordEntriesByClass(OClass iClass, boolean iPolymorphic) getNewRecordEntriesByClusterIds(int[] iIds) Resolves a record with the given RID in the context of this transaction.getRecordEntry(ORID rid) Iterable<? extends ORecordOperation>booleanisActive()booleanisLockedRecord(OIdentifiable iRecord) loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache) loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) lockingStrategy(OIdentifiable iRecord) Deprecated.lockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated.reloadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache) reloadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean force) voidrollback()voidrollback(boolean force, int commitLevelDiff) saveRecord(ORecord record, String clusterName, boolean forceCreate) Saves the given record in this transaction.voidsetCustomData(String name, Object value) Sets the custom value by its name stored in the context of this transaction.setIsolationLevel(OTransaction.ISOLATION_LEVEL iIsolationLevel) Changes the isolation level.unlockRecord(OIdentifiable iRecord) Deprecated.voidupdateIdentityAfterCommit(ORID oldRid, ORID newRid) When commit in transaction is performed all new records will change their identity, but index values will contain stale links, to fix them given method will be called for each entry.
-
Method Details
-
begin
void begin() -
commit
void commit() -
commit
void commit(boolean force) -
rollback
void rollback() -
getIsolationLevel
OTransaction.ISOLATION_LEVEL getIsolationLevel()Returns the current isolation level. -
setIsolationLevel
Changes the isolation level. Default is READ_COMMITTED. When REPEATABLE_READ is set, any record read from the storage is cached in memory to guarantee the repeatable reads. This affects the used RAM and speed (because JVM Garbage Collector job).- Parameters:
iIsolationLevel- Isolation level to set- Returns:
- Current object to allow call in chain
-
rollback
void rollback(boolean force, int commitLevelDiff) -
getDatabase
ODatabaseDocument getDatabase() -
loadRecord
-
reloadRecord
-
reloadRecord
-
loadRecordIfVersionIsNotLatest
ORecord loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException - Throws:
ORecordNotFoundException
-
getStatus
OTransaction.TXSTATUS getStatus() -
getRecordOperations
Iterable<? extends ORecordOperation> getRecordOperations() -
getNewRecordEntriesByClass
-
getNewRecordEntriesByClusterIds
-
getRecordEntry
-
getInvolvedIndexes
-
getIndexChanges
ODocument getIndexChanges() -
close
void close() -
updateIdentityAfterCommit
When commit in transaction is performed all new records will change their identity, but index values will contain stale links, to fix them given method will be called for each entry. This update local transaction maps too.- Parameters:
oldRid- Record identity before commit.newRid- Record identity after commit.
-
amountOfNestedTxs
int amountOfNestedTxs() -
isLockedRecord
-
lockingStrategy
Deprecated. -
lockRecord
@Deprecated OTransaction lockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated. -
unlockRecord
Deprecated. -
getEntryCount
int getEntryCount() -
isActive
boolean isActive()- Returns:
trueif this transaction is active,falseotherwise.
-
saveRecord
Saves the given record in this transaction.- Parameters:
record- the record to save.clusterName- record's cluster name.forceCreate- the force creation flag,trueto force the creation of the record,falseto allow updates.- Returns:
- the record saved.
-
deleteRecord
Deletes the given record in this transaction.- Parameters:
record- the record to delete.
-
getRecord
Resolves a record with the given RID in the context of this transaction.- Parameters:
rid- the record RID.- Returns:
- the resolved record, or
nullif no record is found, orOTransactionAbstract.DELETED_RECORDif the record was deleted in this transaction.
-
addIndexEntry
void addIndexEntry(OIndex index, String indexName, OTransactionIndexChanges.OPERATION operation, Object key, OIdentifiable value) Adds the transactional index entry in this transaction.- Parameters:
index- the index.indexName- the index name.operation- the index operation to register.key- the index key.value- the index key value.
-
addChangedDocument
Adds the given document to a set of changed documents known to this transaction.- Parameters:
document- the document to add.
-
getIndexChanges
Obtains the index changes done in the context of this transaction.- Parameters:
indexName- the index name.- Returns:
- the index changes in question or
nullif index is not found.
-
getIndexChangesInternal
Does the same thing asgetIndexChanges(String), but handles remote storages in a special way.- Parameters:
indexName- the index name.- Returns:
- the index changes in question or
nullif index is not found or storage is remote.
-
getCustomData
Obtains the custom value by its name stored in the context of this transaction.- Parameters:
name- the value name.- Returns:
- the obtained value or
nullif no value found.
-
setCustomData
Sets the custom value by its name stored in the context of this transaction.- Parameters:
name- the value name.value- the value to store.
-
getClientTransactionId
default int getClientTransactionId()- Returns:
- this transaction ID as seen by the client of this transaction.
-
getId
int getId()
-