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);
}
}
Aggregations