/** * * @param b Bucket to evaluate * @param moveSource * @return true if it is allowed to be recovered * @since gemfire59poc */ public static boolean bucketIsAllowedOnThisHost(Bucket b, InternalDistributedMember moveSource) { if (b.getDistributionManager().enforceUniqueZone()) { Set<InternalDistributedMember> hostingMembers = b.getBucketOwners(); Set<InternalDistributedMember> buddyMembers = b.getDistributionManager().getMembersInThisZone(); boolean intersects = SetUtils.intersectsWith(hostingMembers, buddyMembers); boolean sourceIsOneThisHost = moveSource != null && buddyMembers.contains(moveSource); return !intersects || sourceIsOneThisHost; } else { return true; } } }
/** * * @param b Bucket to evaluate * @param moveSource * @return true if it is allowed to be recovered * @since gemfire59poc */ public static boolean bucketIsAllowedOnThisHost(Bucket b, InternalDistributedMember moveSource) { if (b.getDistributionManager().enforceUniqueZone()) { Set<InternalDistributedMember> hostingMembers = b.getBucketOwners(); Set<InternalDistributedMember> buddyMembers = b.getDistributionManager().getMembersInThisZone(); boolean intersects = SetUtils.intersectsWith(hostingMembers, buddyMembers); boolean sourceIsOneThisHost = moveSource != null && buddyMembers.contains(moveSource); return !intersects || sourceIsOneThisHost; } else { return true; } } }
/** * Called by the RegionAdvisor.profileRemoved, this method * tests to see if the missing member is the primary elector * for this bucket. * * We can't call this method from BucketAdvisor.profileRemoved, * because the primaryElector may not actually host the bucket. * @param profile */ public void checkForLostPrimaryElector(Profile profile) { //If the member that went away was in the middle of creating //the bucket, finish the bucket creation. if(this.primaryElector != null && this.primaryElector.equals(profile.getDistributedMember())) { if (logger.isDebugEnabled()) { logger.debug("Bucket {} lost the member responsible for electing the primary. Finishing bucket creation", getBucket().getFullPath()); } this.primaryElector = getBucket().getDistributionManager().getId(); this.getBucket().getDistributionManager().getWaitingThreadPool().execute(new Runnable() { public void run() { getBucket().getPartitionedRegion().getRedundancyProvider().finishIncompleteBucketCreation(getBucket().getId()); } }); } }
/** * Called by the RegionAdvisor.profileRemoved, this method * tests to see if the missing member is the primary elector * for this bucket. * * We can't call this method from BucketAdvisor.profileRemoved, * because the primaryElector may not actually host the bucket. * @param profile */ public void checkForLostPrimaryElector(Profile profile) { //If the member that went away was in the middle of creating //the bucket, finish the bucket creation. if(this.primaryElector != null && this.primaryElector.equals(profile.getDistributedMember())) { LogWriterI18n log = getLogWriter(); if(log.fineEnabled()) { log.fine("Bucket " + getBucket().getFullPath() + " lost the member responsible for electing the primary. Finishing bucket creation"); } this.primaryElector = getBucket().getDistributionManager().getId(); this.getBucket().getDistributionManager().getWaitingThreadPool().execute(new Runnable() { public void run() { getBucket().getPartitionedRegion().getRedundancyProvider().finishIncompleteBucketCreation(getBucket().getId()); } }); } }