Class OTransactionNoTx
java.lang.Object
com.orientechnologies.orient.core.tx.OTransactionAbstract
com.orientechnologies.orient.core.tx.OTransactionNoTx
- All Implemented Interfaces:
OTransaction
No operation transaction.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
OTransactionAbstract.LockedRecordMetadataNested classes/interfaces inherited from interface com.orientechnologies.orient.core.tx.OTransaction
OTransaction.ISOLATION_LEVEL, OTransaction.TXSTATUS, OTransaction.TXTYPE -
Field Summary
Fields inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
database, DELETED_RECORD, isolationLevel, locks, status -
Constructor Summary
ConstructorsConstructorDescriptionOTransactionNoTx(ODatabaseDocumentInternal iDatabase, Map<ORID, OTransactionAbstract.LockedRecordMetadata> noTxLocks) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangedDocument(ODocument document) Adds the given document to a set of changed documents known to this transaction.voidaddIndexEntry(OIndex delegate, String indexName, OTransactionIndexChanges.OPERATION status, Object key, OIdentifiable value) Adds the transactional index entry in this transaction.intvoidbegin()voidvoidvoidcommit()voidcommit(boolean force) voiddeleteRecord(ORecord iRecord, ODatabase.OPERATION_MODE iMode) Deletes the record.getCustomData(String iName) Obtains the custom value by its name stored in the context of this transaction.intintgetId()getIndexChanges(String iName) Obtains the index changes done in the context of this transaction.getIndexChangesInternal(String indexName) Does the same thing asOTransaction.getIndexChanges(String), but handles remote storages in a special way.getNewRecordEntriesByClass(OClass iClass, boolean iPolymorphic) getNewRecordEntriesByClusterIds(int[] iIds) Resolves a record with the given RID in the context of this transaction.intgetRecordEntry(ORID rid) voidbooleanloadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache) loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated.loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated.loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) reloadRecord(ORID rid, ORecord record, String fetchPlan, boolean ignoreCache) reloadRecord(ORID rid, ORecord record, String fetchPlan, boolean ignoreCache, boolean force) voidrollback()voidrollback(boolean force, int commitLevelDiff) saveRecord(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) Update the record.voidsetCustomData(String iName, Object iValue) Sets the custom value by its name stored in the context of this transaction.setIsolationLevel(OTransaction.ISOLATION_LEVEL isolationLevel) Changes the isolation level.voidsetUsingLog(boolean useLog) If you set this flag to false, you are unable to Rollback data changes in case of exception Restore data in case of server crashvoidupdateIdentityAfterCommit(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.Methods inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
close, getDatabase, getInternalLocks, getIsolationLevel, getLockedRecords, getStatus, isActive, isLockedRecord, lockingStrategy, lockRecord, setDatabase, setLocks, trackLockedRecord, trackUnlockRecord, unlockRecord, updateCacheFromEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.tx.OTransaction
getClientTransactionId
-
Constructor Details
-
OTransactionNoTx
public OTransactionNoTx(ODatabaseDocumentInternal iDatabase, Map<ORID, OTransactionAbstract.LockedRecordMetadata> noTxLocks)
-
-
Method Details
-
begin
public void begin() -
commit
public void commit() -
getEntryCount
public int getEntryCount() -
commit
public void commit(boolean force) -
rollback
public void rollback() -
loadRecord
@Deprecated public ORecord loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated. -
loadRecord
@Deprecated public ORecord loadRecord(ORID iRid, ORecord iRecord, String iFetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY iLockingStrategy) Deprecated. -
loadRecord
-
reloadRecord
-
reloadRecord
-
loadRecordIfVersionIsNotLatest
public ORecord loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException - Throws:
ORecordNotFoundException
-
saveRecord
public ORecord saveRecord(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) Update the record.- Parameters:
iRecord-iForceCreate-iRecordCreatedCallback-iRecordUpdatedCallback-iClusterName- record's cluster name.iMode- the operation mode.- Returns:
- the record saved.
-
setIsolationLevel
Description copied from interface:OTransactionChanges 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).- Specified by:
setIsolationLevelin interfaceOTransaction- Overrides:
setIsolationLevelin classOTransactionAbstract- Parameters:
isolationLevel- Isolation level to set- Returns:
- Current object to allow call in chain
-
deleteRecord
Deletes the record.- Parameters:
iRecord- the record to delete.iMode- the operation mode.
-
getCurrentRecordEntries
-
getRecordOperations
-
getNewRecordEntriesByClass
-
getNewRecordEntriesByClusterIds
-
clearRecordEntries
public void clearRecordEntries() -
getRecordEntriesSize
public int getRecordEntriesSize() -
getRecord
Description copied from interface:OTransactionResolves 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.
-
getRecordEntry
-
isUsingLog
public boolean isUsingLog() -
setCustomData
Description copied from interface:OTransactionSets the custom value by its name stored in the context of this transaction.- Parameters:
iName- the value name.iValue- the value to store.
-
getCustomData
Description copied from interface:OTransactionObtains the custom value by its name stored in the context of this transaction.- Parameters:
iName- the value name.- Returns:
- the obtained value or
nullif no value found.
-
setUsingLog
public void setUsingLog(boolean useLog) Description copied from interface:OTransactionIf you set this flag to false, you are unable to- Rollback data changes in case of exception
- Restore data in case of server crash
So you practically unable to work in multithreaded environment and keep data consistent.
-
getIndexChanges
-
addIndexEntry
public void addIndexEntry(OIndex delegate, String indexName, OTransactionIndexChanges.OPERATION status, Object key, OIdentifiable value) Description copied from interface:OTransactionAdds the transactional index entry in this transaction.- Parameters:
delegate- the index.indexName- the index name.status- the index operation to register.key- the index key.value- the index key value.
-
addChangedDocument
Description copied from interface:OTransactionAdds the given document to a set of changed documents known to this transaction.- Parameters:
document- the document to add.
-
clearIndexEntries
public void clearIndexEntries() -
getIndexChanges
Description copied from interface:OTransactionObtains the index changes done in the context of this transaction.- Parameters:
iName- the index name.- Returns:
- the index changes in question or
nullif index is not found.
-
getId
public int getId() -
getInvolvedIndexes
-
updateIdentityAfterCommit
Description copied from interface:OTransactionWhen 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
public int amountOfNestedTxs() -
rollback
public void rollback(boolean force, int commitLevelDiff) -
getIndexChangesInternal
Description copied from interface:OTransactionDoes the same thing asOTransaction.getIndexChanges(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.
-
internalRollback
public void internalRollback()- Specified by:
internalRollbackin classOTransactionAbstract
-