/** * All callers must have {@link #releaseReadLock(DiskRegion)} in a matching * finally block. Note that this is no longer implemented by getting a read * lock but instead locks the same lock that acquireWriteLock does. * * @since 5.1 */ void acquireReadLock(DiskRegion dr) { dr.basicAcquireReadLock(); synchronized (this.closeRegionGuard) { entryOpsCount.incrementAndGet(); if (dr.isRegionClosed()) { dr.releaseReadLock(); throw new RegionDestroyedException( "The DiskRegion has been closed or destroyed", dr.getName()); } } }
/** * All callers must have {@link #releaseReadLock(DiskRegion)} in a matching * finally block. Note that this is no longer implemented by getting a read * lock but instead locks the same lock that acquireWriteLock does. * * @since 5.1 */ void acquireReadLock(DiskRegion dr) { dr.basicAcquireReadLock(); synchronized (this.closeRegionGuard) { entryOpsCount.incrementAndGet(); if (dr.isRegionClosed()) { dr.releaseReadLock(); throw new RegionDestroyedException( "The DiskRegion has been closed or destroyed", dr.getName()); } } }
public void replaceIncompatibleEntry(DiskEntry old, DiskEntry repl) { acquireReadLock(); try { getOplogSet().getChild().replaceIncompatibleEntry(this, old, repl); } finally { releaseReadLock(); } }
public void replaceIncompatibleEntry(DiskEntry old, DiskEntry repl) { acquireReadLock(); try { getOplogSet().getChild().replaceIncompatibleEntry(this, old, repl); } finally { releaseReadLock(); } } }
public static void doAsyncFlush(VersionTag tag, LocalRegion region) { if (region.isThisRegionBeingClosedOrDestroyed()) return; DiskRegion dr = region.getDiskRegion(); if (!dr.isBackup()) { return; } assert !dr.isSync(); dr.acquireReadLock(); try { dr.getDiskStore().putVersionTagOnly(region, tag, true); } finally { dr.releaseReadLock(); } }
public static void doAsyncFlush(VersionTag tag, LocalRegion region) { if (region.isThisRegionBeingClosedOrDestroyed()) return; DiskRegion dr = region.getDiskRegion(); if (!dr.isBackup()) { return; } assert !dr.isSync(); dr.acquireReadLock(); try { dr.getDiskStore().putVersionTagOnly(region, tag, true); } finally { dr.releaseReadLock(); } }
/** * Testing purpose only * Get the value of an entry that is on disk without faulting * it in and without looking in the io buffer. * @since 3.2.1 */ static Object getValueOnDisk(DiskEntry entry, DiskRegion dr) { DiskId id = entry.getDiskId(); if (id == null) { return null; } dr.acquireReadLock(); try { synchronized (id) { if (id == null || (dr.isBackup() && id.getKeyId() == DiskRegion.INVALID_ID) || (!entry.isValueNull() && id.needsToBeWritten() && !EntryBits.isRecoveredFromDisk(id.getUserBits()))/*fix for bug 41942*/) { return null; } return dr.getNoBuffer(id); } } finally { dr.releaseReadLock(); } }
/** * Testing purpose only * Get the value of an entry that is on disk without faulting * it in and without looking in the io buffer. * @since 3.2.1 */ static Object getValueOnDisk(DiskEntry entry, DiskRegion dr) { DiskId id = entry.getDiskId(); if (id == null) { return null; } dr.acquireReadLock(); try { synchronized (id) { if ((dr.isBackup() && id.getKeyId() == DiskRegion.INVALID_ID) || (!entry.isValueNull() && id.needsToBeWritten() && !EntryBits.isRecoveredFromDisk(id.getUserBits()))/*fix for bug 41942*/) { return null; } return dr.getNoBuffer(id); } } finally { dr.releaseReadLock(); } }
/** * Get the serialized value directly from disk. Returned object may be * a {@link CachedDeserializable}. Goes straight to disk without faulting * into memory. Only looks at the disk storage, not at heap storage. * @param entry the entry used to identify the value to fetch * @param dr the persistent storage from which to fetch the value * @return either null, byte array, or CacheDeserializable * @since gemfire57_hotfix */ public static Object getSerializedValueOnDisk( DiskEntry entry, DiskRegion dr) { DiskId did = entry.getDiskId(); if (did == null) { return null; } dr.acquireReadLock(); try { synchronized (did) { if (did == null || (dr.isBackup() && did.getKeyId() == DiskRegion.INVALID_ID)) { return null; } else if (!entry.isValueNull() && did.needsToBeWritten() && !EntryBits.isRecoveredFromDisk(did.getUserBits())/*fix for bug 41942*/) { return null; } return dr.getSerializedData(did); } } finally { dr.releaseReadLock(); } }
/** * Get the serialized value directly from disk. Returned object may be * a {@link CachedDeserializable}. Goes straight to disk without faulting * into memory. Only looks at the disk storage, not at heap storage. * @param entry the entry used to identify the value to fetch * @param dr the persistent storage from which to fetch the value * @return either null, byte array, or CacheDeserializable * @since gemfire57_hotfix */ public static Object getSerializedValueOnDisk( DiskEntry entry, DiskRegion dr) { DiskId did = entry.getDiskId(); if (did == null) { return null; } dr.acquireReadLock(); try { synchronized (did) { if (did == null || (dr.isBackup() && did.getKeyId() == DiskRegion.INVALID_ID)) { return null; } else if (!entry.isValueNull() && did.needsToBeWritten() && !EntryBits.isRecoveredFromDisk(did.getUserBits())/*fix for bug 41942*/) { return null; } return dr.getSerializedData(did); } } finally { dr.releaseReadLock(); } }