final LogWriter logger = GemFireCacheImpl.getExisting().getLogger(); if (logger.infoEnabled()) { logger.info("LockingPolicy." + name() + ": found existing lockMode " + currentMode + " requested " + requestedMode + " on object: " + lockObj);
@Override public final void acquireLock(final ExclusiveSharedLockObject lockObj, final LockMode mode, final int flags, final Object lockOwner, final Object context, final AbstractOperationMessage msg) throws ConflictException, LockTimeoutException { // We allow for READ_ONLY locks to co-exist with EX_SH locks to minimize // conflicts. It also helps us to enforce the policy that reads never get // a conflict. So in this case the commit becomes two-phase and the lock // upgrade to EX mode is done in pre-commit phase that throws a conflict // exception. // Removed the ALLOW_READ_ONLY_WITH_EX_SH flag due to the following // possible scenario: // 1) child starts transactional insert but still not reached insert // 2) parent delete ReferencedKeyChecker searches and finds nothing, // not even a transactional entry so does nothing // 3) parent delete acquires write lock on parent entry // 4) child insert acquires write lock on child entry and READ_ONLY // on parent entry (which does not get a conflict due to this flag) // 5) child insert finishes and commits successfully releasing READ_ONLY // 6) parent delete then finishes successfully acquireLockFailFast(lockObj, mode, flags, lockOwner, context, msg); }
@Override public final Object lockForRead(final ExclusiveSharedLockObject lockObj, final LockMode mode, final Object lockOwner, final Object context, final int iContext, final AbstractOperationMessage msg, boolean allowTombstones, ReadEntryUnderLock reader) { // currently only CONFLICT_WITH_EX flag is honoured; if more flags are // added then ensure that none overlap with those in ReadEntryUnderLock acquireLockFailFast(lockObj, mode, (iContext & ExclusiveSharedSynchronizer.CONFLICT_WITH_EX), lockOwner, context, msg); return Locked; }