void notifyCacheMembersOfClose() { if (logger.isDebugEnabled()) { logger.debug("sending messages to all peers for removing this server.."); } for (PartitionedRegion pr : this.cache.getPartitionedRegions()) { Map<Integer, BucketAdvisor.BucketProfile> profiles = new HashMap<>(); // get all local real bucket advisors Map<Integer, BucketAdvisor> advisors = pr.getRegionAdvisor().getAllBucketAdvisors(); for (Map.Entry<Integer, BucketAdvisor> entry : advisors.entrySet()) { BucketAdvisor advisor = entry.getValue(); BucketProfile bp = (BucketProfile) advisor.createProfile(); advisor.updateServerBucketProfile(bp); profiles.put(entry.getKey(), bp); } Set recipients = pr.getRegionAdvisor().adviseAllPRNodes(); // send it to all in one message ReplyProcessor21 reply = AllBucketProfilesUpdateMessage.send(recipients, pr.getDistributionManager(), pr.getPRId(), profiles); if (reply != null) { reply.waitForRepliesUninterruptibly(); } } }
/** * Concurrency: protected by synchronizing on *this* */ @Override protected void profileUpdated(Profile profile) { super.profileUpdated(profile); if (updateRedundancy() > 0) { // wake up any threads in waitForRedundancy or waitForPrimary this.notifyAll(); } this.regionAdvisor.updateBucketStatus(this.getBucket().getId(), profile.peerMemberId, false); if (logger.isDebugEnabled()) { logger.debug("Profile updated {} Profile : {}", getBucket().getFullPath(), profile); } synchronized (this) { updateServerBucketProfile(); } }
advisor.updateServerBucketProfile(bp);
/** * Concurrency: protected by synchronizing on *this* */ @Override protected void profileCreated(Profile profile) { this.regionAdvisor.incrementBucketCount(profile); super.profileCreated(profile); if (updateRedundancy() > 0) { // wake up any threads in waitForRedundancy or waitForPrimary this.notifyAll(); } this.regionAdvisor.updateBucketStatus(this.getBucket().getId(), profile.peerMemberId, false); if (logger.isDebugEnabled()) { logger.debug("Profile added {} Profile : {}", getBucket().getFullPath(), profile); } synchronized (this) { updateServerBucketProfile(); } }
/** * Concurrency: protected by synchronizing on *this* */ @Override protected void profileRemoved(Profile profile) { if (profile != null) { this.regionAdvisor.updateBucketStatus(this.getBucket().getId(), profile.getDistributedMember(), true); this.regionAdvisor.decrementsBucketCount(profile); } updateRedundancy(); if (logger.isDebugEnabled()) { logger.debug("Profile removed {} the member lost {} Profile : {}", getBucket().getFullPath(), profile.getDistributedMember(), profile); } synchronized (this) { updateServerBucketProfile(); } }
updateServerBucketProfile(bp); InternalDistributedMember primary = basicGetPrimaryMember(); HashSet hostsAndProxyMembers = new HashSet();