@Override public boolean include(Profile profile) { if (profile instanceof PartitionProfile && nodes.contains(profile.getDistributedMember())) { PartitionProfile p = (PartitionProfile) profile; orderedSet.add(new NodeBucketSize(p.numBuckets, p.getDistributedMember())); return true; } else if (profile instanceof PartitionProfile && nodes.contains(self)) { orderedSet.add(new NodeBucketSize(getBucketSet().size(), self)); return true; } return false; } });
/** All advise methods go through this method */ protected Set<InternalDistributedMember> adviseFilter(Filter f) { initializationGate(); Set<InternalDistributedMember> recipients = null; Profile[] locProfiles = this.profiles; // grab current profiles for (int i = 0; i < locProfiles.length; i++) { Profile profile = locProfiles[i]; if (f == null || f.include(profile)) { if (recipients == null) { recipients = new HashSet<InternalDistributedMember>(); } recipients.add(profile.getDistributedMember()); } } if (recipients == null) { return Collections.emptySet(); } else { return recipients; } }
@Override protected void profileRemoved(Profile profile) { if (logger.isDebugEnabled()) { logger.debug("CDA: removing profile {}", profile); } if (getAdvisee() instanceof LocalRegion && profile != null) { ((LocalRegion) getAdvisee()).removeCriticalMember(profile.getDistributedMember()); } }
logger.trace(LogMarker.DISTRIBUTION_ADVISOR_VERBOSE, "putProfile: ignoring {}; not in current view for {}", newProfile.getDistributedMember(), getAdvisee().getFullPath()); profileCreated(newProfile); notifyListenersProfileAdded(newProfile); notifyListenersMemberAdded(newProfile.getDistributedMember()); } else { notifyListenersProfileUpdated(newProfile);
profileToRemove); this.removedProfiles.put(profileToRemove.getDistributedMember(), Integer.valueOf(profileToRemove.getSerialNumber())); basicRemoveId(profileToRemove.getId(), crashed, destroyed);
notifyListenersMemberRemoved(profileRemoved.getDistributedMember(), crashed); profileRemoved.cleanUp(); 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. * */ public void checkForLostPrimaryElector(Profile profile) { // If the member that went away was in the middle of creating // the bucket, finish the bucket creation. ProfileId elector = this.primaryElector; if (elector != null && elector.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() { @Override public void run() { getBucket().getPartitionedRegion().getRedundancyProvider() .finishIncompleteBucketCreation(getBucket().getId()); } }); } }
/** * 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(); } }
public void profileCreated(Profile profile) { if (profile instanceof CacheServerProfile) { CacheServerProfile bp = (CacheServerProfile) profile; ServerLocation location = buildServerLocation(bp); String[] groups = bp.getGroups(); loadSnapshot.addServer(location, groups, bp.getInitialLoad(), bp.getLoadPollInterval()); if (logger.isDebugEnabled()) { logger.debug("ServerLocator: Received load from a new server {}, {}", location, bp.getInitialLoad()); } synchronized (ownerMap) { ownerMap.put(location, profile.getDistributedMember()); } } else { cachedLocators = null; } }
public Profile getProfile(ProfileId id) { Profile[] allProfiles = this.profiles; // volatile read boolean isIDM = (id instanceof InternalDistributedMember); for (int i = 0; i < allProfiles.length; i++) { if (isIDM) { if (allProfiles[i].getDistributedMember().equals(id)) { return allProfiles[i]; } } else { if (allProfiles[i].getId().equals(id)) { return allProfiles[i]; } } } return null; }
protected int indexOfMemberId(ProfileId id) { Assert.assertHoldsLock(this, true); Profile[] profs = this.profiles; // volatile read for (int i = 0; i < profs.length; i++) { Profile p = profs[i]; if (id instanceof InternalDistributedMember) { if (p.getDistributedMember().equals(id)) return i; } else { if (p.getId().equals(id)) return i; } } return -1; }
public void decrementsBucketCount(Profile p) { PartitionProfile pp = (PartitionProfile) getProfile(p.getDistributedMember()); if (pp != null) { Assert.assertTrue(pp.isDataStore); pp.numBuckets--; if (pp.numBuckets < 0) { pp.numBuckets = 0; } } }
public void incrementBucketCount(Profile p) { PartitionProfile pp = (PartitionProfile) getProfile(p.getDistributedMember()); if (pp != null) { Assert.assertTrue(pp.isDataStore); pp.numBuckets++; } }
/** * Return true if the memberId on the specified Profile is a current member of the distributed * system. * * @since GemFire 5.7 */ protected boolean isCurrentMember(Profile p) { return getDistributionManager().isCurrentMember(p.getDistributedMember()); }
@Override public void profileUpdated(Profile profile) { CacheProfile cp = (CacheProfile) profile; if (cp.persistentID != null && cp.persistenceInitialized) { memberOnline(profile.getDistributedMember(), cp.persistentID); } }
@Override public void profileRemoved(Profile profile, boolean destroyed) { CacheProfile cp = (CacheProfile) profile; if (cp.persistentID != null) { if (destroyed) { memberRemoved(cp.persistentID, false); } else { memberOffline(profile.getDistributedMember(), cp.persistentID); } } }