protected void checkVersions(final ORecordId rid, final int iRecordVersion, final int iDatabaseVersion) { if (OFastConcurrentModificationException.enabled()) throw OFastConcurrentModificationException.instance(); else throw new OConcurrentModificationException(rid, iDatabaseVersion, iRecordVersion, ORecordOperation.UPDATED); } }
public OConcurrentModificationException(final ORID iRID, final int iDatabaseVersion, final int iRecordVersion, final int iRecordOperation) { super(makeMessage(iRecordOperation, iRID, iDatabaseVersion, iRecordVersion),OErrorCode.MVCC_ERROR); if (OFastConcurrentModificationException.enabled()) throw new IllegalStateException("Fast-throw is enabled. Use OFastConcurrentModificationException.instance() instead"); rid = iRID; databaseVersion = iDatabaseVersion; recordVersion = iRecordVersion; recordOperation = iRecordOperation; }
@Override public RESULT onRecordBeforeDelete(final ODocument iDocument) { final ORecordVersion version = iDocument.getRecordVersion(); // Cache the transaction-provided value if (iDocument.fields() == 0) { // FORCE LOADING OF CLASS+FIELDS TO USE IT AFTER ON onRecordAfterDelete METHOD iDocument.reload(); if (version.getCounter() > -1 && iDocument.getRecordVersion().compareTo(version) != 0) // check for record version errors if (OFastConcurrentModificationException.enabled()) throw OFastConcurrentModificationException.instance(); else throw new OConcurrentModificationException(iDocument.getIdentity(), iDocument.getRecordVersion(), version, ORecordOperation.DELETED); } return RESULT.RECORD_NOT_CHANGED; }