Search in sources :

Example 1 with ARMLockTestHook

use of org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook in project geode by apache.

the class DistributedRegion method lockLocallyForClear.

/**
   * pause local operations so that a clear() can be performed and flush comm channels to the given
   * member
   */
void lockLocallyForClear(DM dm, InternalDistributedMember locker, CacheEvent event) {
    RegionVersionVector rvv = getVersionVector();
    ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook();
    if (armLockTestHook != null) {
        armLockTestHook.beforeLock(this, event);
    }
    if (rvv != null) {
        // block new operations from being applied to the region map
        rvv.lockForClear(getFullPath(), dm, locker);
        // Check for region destroyed after we have locked, to make sure
        // we don't continue a clear if the region has been destroyed.
        checkReadiness();
        // Only need to flush if NOACK at this point
        if (this.getAttributes().getScope().isDistributedNoAck()) {
            Set<InternalDistributedMember> members = getDistributionAdvisor().adviseCacheOp();
            StateFlushOperation.flushTo(members, this);
        }
    }
    if (armLockTestHook != null) {
        armLockTestHook.afterLock(this, null);
    }
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) ARMLockTestHook(org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook) RegionVersionVector(org.apache.geode.internal.cache.versions.RegionVersionVector)

Example 2 with ARMLockTestHook

use of org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook in project geode by apache.

the class DistributedRegion method releaseWriteLocksForClear.

/**
   * releases the locks obtained in obtainWriteLocksForClear
   */
private void releaseWriteLocksForClear(RegionEventImpl regionEvent, Set<InternalDistributedMember> participants) {
    ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook();
    if (armLockTestHook != null) {
        armLockTestHook.beforeRelease(this, regionEvent);
    }
    getVersionVector().unlockForClear(getMyId());
    DistributedClearOperation.releaseLocks(regionEvent, participants);
    if (armLockTestHook != null) {
        armLockTestHook.afterRelease(this, regionEvent);
    }
}
Also used : ARMLockTestHook(org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook)

Aggregations

ARMLockTestHook (org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook)2 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 RegionVersionVector (org.apache.geode.internal.cache.versions.RegionVersionVector)1