try { boolean locked = b.doLockForPrimary(true); if (locked) { obtained.add(b);
for (BucketRegion br : lockedRegions) { try { br.doLockForPrimary(false); } catch (RegionDestroyedException rde) { done = false;
/** * Checks to make sure that this node is primary, and locks the bucket * to make sure the bucket stays the primary bucket while the write * is in progress. Any call to this method must be followed with a call * to endLocalWrite(). * @param event */ private boolean beginLocalWrite(EntryEventImpl event) { if (skipWriteLock(event)) { return false; } if (cache.isCacheAtShutdownAll()) { throw new CacheClosedException("Cache is shutting down"); } final Object key = event.getKey(); waitUntilLocked(key); // it might wait for long time boolean lockedForPrimary = false; try { doLockForPrimary(false, false); return (lockedForPrimary = true); } finally { if (!lockedForPrimary) { removeAndNotifyKey(key); } } }
/** * Checks to make sure that this node is primary, and locks the bucket * to make sure the bucket stays the primary bucket while the write * is in progress. Any call to this method must be followed with a call * to endLocalWrite(). * @param event */ private boolean beginLocalWrite(EntryEventImpl event) { if(!needWriteLock(event)) { return false; } if (cache.isCacheAtShutdownAll()) { throw new CacheClosedException("Cache is shutting down"); } Object keys[] = new Object[1]; keys[0] = event.getKey(); waitUntilLocked(keys); // it might wait for long time boolean lockedForPrimary = false; try { doLockForPrimary(false); return lockedForPrimary = true; } finally { if (!lockedForPrimary) { removeAndNotifyKeys(keys); } } }
for (BucketRegion br : primaryBuckets) { try { if (!br.doLockForPrimary(false, true)) { done = false; getCancelCriterion().checkCancelInProgress(null);
Object key = keys[0]; try { bucketRegion.doLockForPrimary(false); lockedForPrimary = true;
Object key = keys[0]; try { bucketRegion.doLockForPrimary(false); lockedForPrimary = true;
bucketRegion.doLockForPrimary(false, false); lockedForPrimary = true; } else {