Class OTransactionOptimistic
java.lang.Object
com.orientechnologies.orient.core.tx.OTransactionAbstract
com.orientechnologies.orient.core.tx.OTransactionRealAbstract
com.orientechnologies.orient.core.tx.OTransactionOptimistic
- All Implemented Interfaces:
OTransaction,OTransactionInternal
- Direct Known Subclasses:
OTransactionOptimisticClient,OTransactionOptimisticDistributed,OTransactionOptimisticProxy,OTransactionOptimisticServer
-
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
FieldsFields inherited from class com.orientechnologies.orient.core.tx.OTransactionRealAbstract
allEntries, changedDocuments, id, indexEntries, newObjectCounter, recordIndexOperations, updatedRids, userDataFields inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
database, DELETED_RECORD, isolationLevel, locks, status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue, boolean clientTrackOnly) Bufferizes index changes to be flushed at commit time.intvoidbegin()voidcommit()voidcommit(boolean force) The transaction is reentrant.voidvoiddeleteRecord(ORecord iRecord, ODatabase.OPERATION_MODE iMode) Deletes the given record in this transaction.voidfill(Iterator<ORecordOperation> operations) booleanprotected intvoidbooleanbooleanbooleanRetrieve if log is enabled for the transactionloadRecord(ORID rid, ORecord record, String fetchPlan, boolean ignoreCache) loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy) loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy) loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) reloadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache) reloadRecord(ORID rid, ORecord passedRecord, String fetchPlan, boolean ignoreCache, boolean force) voidprotected voidresolveTracking(ORecordOperation change) voidrollback()voidrollback(boolean force, int commitLevelDiff) saveRecord(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) Saves the given record in this transaction.voidsetSentToServer(boolean sentToServer) voidsetStatus(OTransaction.TXSTATUS iStatus) Change the status of the transaction.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 crashtoString()Methods inherited from class com.orientechnologies.orient.core.tx.OTransactionRealAbstract
addChangedDocument, addIndexEntry, checkTransactionValid, clearIndexEntries, clearRecordEntries, close, getCurrentRecordEntries, getCustomData, getEntryCount, getId, getIndexChanges, getIndexChanges, getIndexChangesInternal, getIndexOperations, getInvolvedIndexes, getMetadata, getNewObjectCounter, getNewRecordEntriesByClass, getNewRecordEntriesByClusterIds, getNoTxLocks, getRecord, getRecordEntry, getRecordOperations, getSerializedOperations, getUpdatedRids, prepareSerializedOperations, resetAllocatedIds, restore, serializeIndexChangeEntry, setCustomData, setMetadataHolder, setNoTxLocks, storageBegun, updateIdentityAfterCommitMethods inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
getDatabase, getInternalLocks, getIsolationLevel, getStatus, isActive, isLockedRecord, lockingStrategy, lockRecord, setDatabase, setIsolationLevel, setLocks, trackLockedRecord, trackUnlockRecord, unlockRecord, updateCacheFromEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.tx.OTransaction
getClientTransactionId, getIsolationLevel, getStatus, isActive, isLockedRecord, lockingStrategy, lockRecord, setIsolationLevel, unlockRecordMethods inherited from interface com.orientechnologies.orient.core.tx.OTransactionInternal
getDatabase, isSequenceTransaction, setDatabase
-
Field Details
-
changed
protected boolean changed
-
-
Constructor Details
-
OTransactionOptimistic
-
-
Method Details
-
begin
public void begin() -
commit
public void commit() -
commit
public void commit(boolean force) The transaction is reentrant. Ifbegin()has been called several times, the actual commit happens only after the same amount ofcommit()calls- Parameters:
force- commit transaction even
-
commitPreallocate
public void commitPreallocate() -
amountOfNestedTxs
public int amountOfNestedTxs() -
rollback
public void rollback() -
internalRollback
public void internalRollback()- Specified by:
internalRollbackin classOTransactionAbstract
-
rollback
public void rollback(boolean force, int commitLevelDiff) -
loadRecord
public ORecord loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy) -
loadRecord
public ORecord loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy) -
loadRecordIfVersionIsNotLatest
public ORecord loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException - Throws:
ORecordNotFoundException
-
reloadRecord
-
reloadRecord
-
loadRecord
-
deleteRecord
Description copied from interface:OTransactionDeletes the given record in this transaction.- Parameters:
iRecord- the record to delete.iMode- the operation mode.
-
saveRecord
public ORecord saveRecord(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) Description copied from interface:OTransactionSaves the given record in this transaction.- Parameters:
iRecord- the record to save.iClusterName- record's cluster name.iMode- the operation mode.iForceCreate- the force creation flag,trueto force the creation of the record,falseto allow updates.iRecordCreatedCallback- the callback to invoke when the record save operation triggered the creation of the record.iRecordUpdatedCallback- the callback to invoke when the record save operation triggered the update of the record.- Returns:
- the record saved.
-
toString
-
isUsingLog
public boolean isUsingLog()Description copied from interface:OTransactionInternalRetrieve if log is enabled for the transaction -
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.
-
setStatus
Description copied from interface:OTransactionInternalChange the status of the transaction. -
addRecord
-
addIndexEntry
public void addIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue, boolean clientTrackOnly) Description copied from class:OTransactionRealAbstractBufferizes index changes to be flushed at commit time.- Overrides:
addIndexEntryin classOTransactionRealAbstract
-
resetChangesTracking
public void resetChangesTracking() -
isChanged
public boolean isChanged() -
isAlreadyCleared
public boolean isAlreadyCleared() -
getLockedRecords
- Specified by:
getLockedRecordsin interfaceOTransactionInternal- Overrides:
getLockedRecordsin classOTransactionAbstract
-
setSentToServer
public void setSentToServer(boolean sentToServer) -
getSentToServer
public boolean getSentToServer() -
fill
-
resolveTracking
-
getTxStartCounter
protected int getTxStartCounter()
-