Class OTransactionRealAbstract
java.lang.Object
com.orientechnologies.orient.core.tx.OTransactionAbstract
com.orientechnologies.orient.core.tx.OTransactionRealAbstract
- All Implemented Interfaces:
OTransaction,OTransactionInternal
- Direct Known Subclasses:
OTransactionOptimistic
public abstract class OTransactionRealAbstract
extends OTransactionAbstract
implements OTransactionInternal
-
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
FieldsModifier and TypeFieldDescriptionprotected Map<ORID,ORecordOperation> token This set is used to track which documents are changed during tx, if documents are changed but not saved all changes are made during tx will be undone.protected intprotected Map<String,OTransactionIndexChanges> protected intprotected Map<ORID,List<OTransactionRecordIndexOperation>> Fields inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
database, DELETED_RECORD, isolationLevel, locks, status -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOTransactionRealAbstract(ODatabaseDocumentInternal database, int id) -
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 iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue) Adds the transactional index entry in this transaction.voidaddIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue, boolean clientTrackOnly) Bufferizes index changes to be flushed at commit time.protected voidvoidvoidvoidclose()Closes the transaction and releases all the acquired locks.getCustomData(String iName) Obtains the custom value by its name stored in the context of this transaction.intintgetId()getIndexChanges(String iIndexName) Bufferizes index changes to be flushed at commit time.getIndexChangesInternal(String indexName) Does the same thing asOTransaction.getIndexChanges(String), but handles remote storages in a special way.Extract all the calculated index operations for the current transaction changes, the key of the map is the index name the value all the changes for the specified index.Optional<byte[]>intgetNewRecordEntriesByClass(OClass iClass, boolean iPolymorphic) Called by class iterator.getNewRecordEntriesByClusterIds(int[] iIds) Called by cluster iterator.Resolves a record with the given RID in the context of this transaction.getRecordEntry(ORID ridPar) Extract a single change from a specified record id.Extract all the record operations for the current transactionIterator<byte[]>voidvoidvoidrestore()protected ODocumentserializeIndexChangeEntry(OTransactionIndexChangesPerKey entry, ODocument indexDoc) voidsetCustomData(String iName, Object iValue) Sets the custom value by its name stored in the context of this transaction.voidsetMetadataHolder(Optional<OTxMetadataHolder> metadata) voidsetNoTxLocks(Map<ORID, OTransactionAbstract.LockedRecordMetadata> noTxLocks) voidvoidupdateIdentityAfterCommit(ORID oldRid, ORID newRid) Notify the transaction for the rid change, the changed will be tracked inside the transaction and used for remapping links.Methods inherited from class com.orientechnologies.orient.core.tx.OTransactionAbstract
getDatabase, getInternalLocks, getIsolationLevel, getLockedRecords, getStatus, internalRollback, isActive, isLockedRecord, lockingStrategy, lockRecord, setDatabase, setIsolationLevel, 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
amountOfNestedTxs, begin, commit, commit, deleteRecord, getClientTransactionId, getIsolationLevel, getStatus, isActive, isLockedRecord, loadRecord, loadRecord, loadRecord, loadRecordIfVersionIsNotLatest, lockingStrategy, lockRecord, reloadRecord, reloadRecord, rollback, rollback, saveRecord, setIsolationLevel, setUsingLog, unlockRecordMethods inherited from interface com.orientechnologies.orient.core.tx.OTransactionInternal
fill, getDatabase, getLockedRecords, isSequenceTransaction, isUsingLog, setDatabase, setStatus
-
Field Details
-
updatedRids
-
allEntries
-
indexEntries
-
recordIndexOperations
-
id
protected int id -
newObjectCounter
protected int newObjectCounter -
userData
-
changedDocuments
token This set is used to track which documents are changed during tx, if documents are changed but not saved all changes are made during tx will be undone.
-
-
Constructor Details
-
OTransactionRealAbstract
-
-
Method Details
-
addChangedDocument
Description copied from interface:OTransactionAdds the given document to a set of changed documents known to this transaction.- Specified by:
addChangedDocumentin interfaceOTransaction- Parameters:
document- the document to add.
-
close
public void close()Description copied from class:OTransactionAbstractCloses the transaction and releases all the acquired locks.- Specified by:
closein interfaceOTransaction- Overrides:
closein classOTransactionAbstract
-
getId
public int getId()- Specified by:
getIdin interfaceOTransaction
-
clearRecordEntries
public void clearRecordEntries()- Specified by:
clearRecordEntriesin interfaceOTransaction
-
restore
public void restore() -
getEntryCount
public int getEntryCount()- Specified by:
getEntryCountin interfaceOTransaction
-
getCurrentRecordEntries
- Specified by:
getCurrentRecordEntriesin interfaceOTransaction
-
getRecordOperations
Description copied from interface:OTransactionInternalExtract all the record operations for the current transaction- Specified by:
getRecordOperationsin interfaceOTransaction- Specified by:
getRecordOperationsin interfaceOTransactionInternal- Returns:
- the record operations, the collection should not be modified.
-
getRecordEntry
Description copied from interface:OTransactionInternalExtract a single change from a specified record id.- Specified by:
getRecordEntryin interfaceOTransaction- Specified by:
getRecordEntryin interfaceOTransactionInternal- Parameters:
ridPar- the record id for the change.- Returns:
- the change or null if there is no change for the specified rid
-
getRecord
Description copied from interface:OTransactionResolves a record with the given RID in the context of this transaction.- Specified by:
getRecordin interfaceOTransaction- 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.
-
getNewRecordEntriesByClass
Called by class iterator.- Specified by:
getNewRecordEntriesByClassin interfaceOTransaction
-
getNewRecordEntriesByClusterIds
Called by cluster iterator.- Specified by:
getNewRecordEntriesByClusterIdsin interfaceOTransaction
-
clearIndexEntries
public void clearIndexEntries()- Specified by:
clearIndexEntriesin interfaceOTransaction
-
getInvolvedIndexes
- Specified by:
getInvolvedIndexesin interfaceOTransaction
-
getIndexChanges
- Specified by:
getIndexChangesin interfaceOTransaction
-
getIndexOperations
Description copied from interface:OTransactionInternalExtract all the calculated index operations for the current transaction changes, the key of the map is the index name the value all the changes for the specified index.- Specified by:
getIndexOperationsin interfaceOTransactionInternal- Returns:
- the index changes, the map should not be modified.
-
getIndexChanges
Bufferizes index changes to be flushed at commit time.- Specified by:
getIndexChangesin interfaceOTransaction- Parameters:
iIndexName- the index name.- Returns:
-
getIndexChangesInternal
Description copied from interface:OTransactionDoes the same thing asOTransaction.getIndexChanges(String), but handles remote storages in a special way.- Specified by:
getIndexChangesInternalin interfaceOTransaction- Parameters:
indexName- the index name.- Returns:
- the index changes in question or
nullif index is not found or storage is remote.
-
addIndexEntry
public void addIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue) Description copied from interface:OTransactionAdds the transactional index entry in this transaction.- Specified by:
addIndexEntryin interfaceOTransaction- Parameters:
delegate- the index.iIndexName- the index name.iOperation- the index operation to register.key- the index key.iValue- the index key value.
-
addIndexEntry
public void addIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue, boolean clientTrackOnly) Bufferizes index changes to be flushed at commit time. -
updateIdentityAfterCommit
Description copied from interface:OTransactionInternalNotify the transaction for the rid change, the changed will be tracked inside the transaction and used for remapping links.- Specified by:
updateIdentityAfterCommitin interfaceOTransaction- Specified by:
updateIdentityAfterCommitin interfaceOTransactionInternal- Parameters:
oldRid- the id old value.newRid- the id new value.
-
checkTransactionValid
protected void checkTransactionValid() -
serializeIndexChangeEntry
protected ODocument serializeIndexChangeEntry(OTransactionIndexChangesPerKey entry, ODocument indexDoc) -
setCustomData
Description copied from interface:OTransactionSets the custom value by its name stored in the context of this transaction.- Specified by:
setCustomDatain interfaceOTransaction- 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.- Specified by:
getCustomDatain interfaceOTransaction- Parameters:
iName- the value name.- Returns:
- the obtained value or
nullif no value found.
-
getUpdatedRids
-
getNewObjectCounter
public int getNewObjectCounter() -
setNoTxLocks
-
getNoTxLocks
-
getMetadata
- Specified by:
getMetadatain interfaceOTransactionInternal
-
storageBegun
public void storageBegun()- Specified by:
storageBegunin interfaceOTransactionInternal
-
setMetadataHolder
- Specified by:
setMetadataHolderin interfaceOTransactionInternal
-
prepareSerializedOperations
- Specified by:
prepareSerializedOperationsin interfaceOTransactionInternal- Throws:
IOException
-
getSerializedOperations
- Specified by:
getSerializedOperationsin interfaceOTransactionInternal
-
resetAllocatedIds
public void resetAllocatedIds()- Specified by:
resetAllocatedIdsin interfaceOTransactionInternal
-