public class OTransactionOptimistic extends OTransactionRealAbstract
OTransactionAbstract.LockedRecordMetadata
OTransaction.ISOLATION_LEVEL, OTransaction.TXSTATUS, OTransaction.TXTYPE
Modifier and Type | Field and Description |
---|---|
protected boolean |
changed |
allEntries, changedDocuments, id, indexEntries, newObjectCounter, recordIndexOperations, updatedRids, userData
database, isolationLevel, locks, status
DELETED_RECORD
Constructor and Description |
---|
OTransactionOptimistic(ODatabaseDocumentInternal iDatabase) |
Modifier and Type | Method and Description |
---|---|
void |
addIndexEntry(OIndex delegate,
String iIndexName,
OTransactionIndexChanges.OPERATION iOperation,
Object key,
OIdentifiable iValue,
boolean clientTrackOnly)
Bufferizes index changes to be flushed at commit time.
|
ORecordOperation |
addRecord(ORecord iRecord,
byte iStatus,
String iClusterName) |
int |
amountOfNestedTxs() |
void |
begin() |
void |
commit() |
void |
commit(boolean force)
The transaction is reentrant.
|
void |
deleteRecord(ORecord iRecord,
ODatabase.OPERATION_MODE iMode)
Deletes the given record in this transaction.
|
void |
fill(Iterator<ORecordOperation> operations) |
Set<ORID> |
getLockedRecords() |
boolean |
getSentToServer() |
void |
internalRollback() |
boolean |
isAlreadyCleared() |
boolean |
isChanged() |
boolean |
isUsingLog()
Retrieve if log is enabled for the transaction
|
ORecord |
loadRecord(ORID rid,
ORecord record,
String fetchPlan,
boolean ignoreCache) |
ORecord |
loadRecord(ORID rid,
ORecord iRecord,
String fetchPlan,
boolean ignoreCache,
boolean iUpdateCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY lockingStrategy) |
ORecord |
loadRecord(ORID rid,
ORecord iRecord,
String fetchPlan,
boolean ignoreCache,
boolean loadTombstone,
OStorage.LOCKING_STRATEGY lockingStrategy) |
ORecord |
loadRecordIfVersionIsNotLatest(ORID rid,
int recordVersion,
String fetchPlan,
boolean ignoreCache) |
ORecord |
reloadRecord(ORID rid,
ORecord iRecord,
String fetchPlan,
boolean ignoreCache) |
ORecord |
reloadRecord(ORID rid,
ORecord passedRecord,
String fetchPlan,
boolean ignoreCache,
boolean force) |
void |
resetChangesTracking() |
protected void |
resolveTracking(ORecordOperation change) |
void |
rollback() |
void |
rollback(boolean force,
int commitLevelDiff) |
ORecord |
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.
|
void |
setSentToServer(boolean sentToServer) |
void |
setStatus(OTransaction.TXSTATUS iStatus)
Change the status of the transaction.
|
void |
setUsingLog(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 crash
|
String |
toString() |
addChangedDocument, addIndexEntry, checkTransaction, clearIndexEntries, clearRecordEntries, close, getCurrentRecordEntries, getCustomData, getEntryCount, getId, getIndexChanges, getIndexChanges, getIndexChangesInternal, getIndexOperations, getInvolvedIndexes, getMetadata, getNewObjectCounter, getNewRecordEntriesByClass, getNewRecordEntriesByClusterIds, getNoTxLocks, getRecord, getRecordEntry, getRecordOperations, getSerializedOperations, getUpdatedRids, prepareSerializedOperations, restore, serializeIndexChangeEntry, setCustomData, setMetadataHolder, setNoTxLocks, storageBegun, updateIdentityAfterCommit
getDatabase, getInternalLocks, getIsolationLevel, getStatus, isActive, isLockedRecord, lockingStrategy, lockRecord, setDatabase, setIsolationLevel, setLocks, trackLockedRecord, trackUnlockRecord, unlockRecord, updateCacheFromEntries
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDatabase, isSequenceTransaction, setDatabase
getClientTransactionId, isActive
public OTransactionOptimistic(ODatabaseDocumentInternal iDatabase)
public void begin()
public void commit()
public void commit(boolean force)
begin()
has been called several times, the actual
commit happens only after the same amount of commit()
callsforce
- commit transaction evenpublic int amountOfNestedTxs()
public void rollback()
public void internalRollback()
internalRollback
in class OTransactionAbstract
public void rollback(boolean force, int commitLevelDiff)
public ORecord loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy)
public ORecord loadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, boolean loadTombstone, OStorage.LOCKING_STRATEGY lockingStrategy)
public ORecord loadRecordIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException
ORecordNotFoundException
public ORecord reloadRecord(ORID rid, ORecord iRecord, String fetchPlan, boolean ignoreCache)
public ORecord reloadRecord(ORID rid, ORecord passedRecord, String fetchPlan, boolean ignoreCache, boolean force)
public ORecord loadRecord(ORID rid, ORecord record, String fetchPlan, boolean ignoreCache)
public void deleteRecord(ORecord iRecord, ODatabase.OPERATION_MODE iMode)
OBasicTransaction
iRecord
- the record to delete.iMode
- the operation mode.public ORecord saveRecord(ORecord iRecord, String iClusterName, ODatabase.OPERATION_MODE iMode, boolean iForceCreate, ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback)
OBasicTransaction
iRecord
- the record to save.iClusterName
- record's cluster name.iMode
- the operation mode.iForceCreate
- the force creation flag, true
to force the creation of the record,
false
to 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.public boolean isUsingLog()
OTransactionInternal
public void setUsingLog(boolean useLog)
OTransaction
So you practically unable to work in multithreaded environment and keep data consistent.
public void setStatus(OTransaction.TXSTATUS iStatus)
OTransactionInternal
public ORecordOperation addRecord(ORecord iRecord, byte iStatus, String iClusterName)
public void addIndexEntry(OIndex delegate, String iIndexName, OTransactionIndexChanges.OPERATION iOperation, Object key, OIdentifiable iValue, boolean clientTrackOnly)
OTransactionRealAbstract
addIndexEntry
in class OTransactionRealAbstract
public void resetChangesTracking()
public boolean isChanged()
public boolean isAlreadyCleared()
public Set<ORID> getLockedRecords()
getLockedRecords
in interface OTransactionInternal
getLockedRecords
in class OTransactionAbstract
public void setSentToServer(boolean sentToServer)
public boolean getSentToServer()
public void fill(Iterator<ORecordOperation> operations)
protected void resolveTracking(ORecordOperation change)
Copyright © 2009–2020 OrientDB. All rights reserved.