Search in sources :

Example 1 with BucketPersistenceAdvisor

use of org.apache.geode.internal.cache.BucketPersistenceAdvisor in project geode by apache.

the class MembershipFlushRequest method process.

@Override
protected void process(DistributionManager dm) {
    int initLevel = LocalRegion.ANY_INIT;
    int oldLevel = LocalRegion.setThreadInitLevelRequirement(initLevel);
    ReplyException exception = null;
    try {
        // get the region from the path, but do NOT wait on initialization,
        // otherwise we could have a distributed deadlock
        Cache cache = CacheFactory.getInstance(dm.getSystem());
        PartitionedRegion region = (PartitionedRegion) cache.getRegion(this.regionPath);
        if (region != null && region.getRegionAdvisor().isInitialized()) {
            ProxyBucketRegion[] proxyBuckets = region.getRegionAdvisor().getProxyBucketArray();
            // buckets are null if initPRInternals is still not complete
            if (proxyBuckets != null) {
                for (ProxyBucketRegion bucket : proxyBuckets) {
                    final BucketPersistenceAdvisor persistenceAdvisor = bucket.getPersistenceAdvisor();
                    if (persistenceAdvisor != null) {
                        persistenceAdvisor.flushMembershipChanges();
                    }
                }
            }
        }
    } catch (RegionDestroyedException e) {
    // ignore
    } catch (CancelException e) {
    // ignore
    } catch (VirtualMachineError e) {
        SystemFailure.initiateFailure(e);
        throw e;
    } catch (Throwable t) {
        SystemFailure.checkFailure();
        exception = new ReplyException(t);
    } finally {
        LocalRegion.setThreadInitLevelRequirement(oldLevel);
        ReplyMessage replyMsg = new ReplyMessage();
        replyMsg.setRecipient(getSender());
        replyMsg.setProcessorId(processorId);
        if (exception != null) {
            replyMsg.setException(exception);
        }
        dm.putOutgoing(replyMsg);
    }
}
Also used : BucketPersistenceAdvisor(org.apache.geode.internal.cache.BucketPersistenceAdvisor) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) ProxyBucketRegion(org.apache.geode.internal.cache.ProxyBucketRegion) CancelException(org.apache.geode.CancelException) ReplyException(org.apache.geode.distributed.internal.ReplyException) ReplyMessage(org.apache.geode.distributed.internal.ReplyMessage) Cache(org.apache.geode.cache.Cache)

Aggregations

CancelException (org.apache.geode.CancelException)1 Cache (org.apache.geode.cache.Cache)1 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)1 ReplyException (org.apache.geode.distributed.internal.ReplyException)1 ReplyMessage (org.apache.geode.distributed.internal.ReplyMessage)1 BucketPersistenceAdvisor (org.apache.geode.internal.cache.BucketPersistenceAdvisor)1 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)1 ProxyBucketRegion (org.apache.geode.internal.cache.ProxyBucketRegion)1