/** * Dumps out all profiles in this advisor. * * @param infoMsg prefix message to log */ public void dumpProfiles(String infoMsg) { Profile[] profs = this.profiles; final StringBuffer buf = new StringBuffer(2000); if (infoMsg != null) { buf.append(infoMsg); buf.append(": "); } buf.append("FYI, DUMPING PROFILES IN "); buf.append(toString()); buf.append(":\n"); buf.append("My Profile="); buf.append(getAdvisee().getProfile()); buf.append("\nOther Profiles:\n"); for (int i = 0; i < profs.length; i++) { buf.append("\t"); buf.append(profs[i].toString()); buf.append("\n"); } if (logger.isDebugEnabled()) { logger.debug(buf.toString()); } }
/** * Tell local controllers about the received profile. Also if exchange profiles then add each * local controller to reply. * * @since GemFire 5.7 */ protected void tellLocalControllers(boolean removeProfile, boolean exchangeProfiles, final List<Profile> replyProfiles) { final List<Locator> locators = Locator.getLocators(); for (int i = 0; i < locators.size(); i++) { InternalLocator l = (InternalLocator) locators.get(i); DistributionAdvisee advisee = l.getServerLocatorAdvisee(); if (advisee != null && advisee.getProfile().equals(this)) { continue; } // negative value for port indicates fake profile // meant to only gather remote profiles during profile exchange if (this.port > 0) { handleDistributionAdvisee(advisee, removeProfile, exchangeProfiles, replyProfiles); } else if (exchangeProfiles && advisee != null) { replyProfiles.add(advisee.getProfile()); } } }
/** * Attempts to process this message with the specified {@link DistributionAdvisee}. Also if * exchange profiles then add the profile from {@link DistributionAdvisee} to reply. * * @param advisee the CacheDistributionAdvisee to apply this profile to * @param removeProfile true to remove profile else add profile * @param exchangeProfiles true to add the profile to reply */ protected void handleDistributionAdvisee(DistributionAdvisee advisee, boolean removeProfile, boolean exchangeProfiles, final List<Profile> replyProfiles) { final DistributionAdvisor da; if (advisee != null && (da = advisee.getDistributionAdvisor()) != null) { if (removeProfile) { da.removeProfile(this, false); } else { da.putProfile(this); } if (exchangeProfiles) { // assume non-null replyProfiles when exchangeProfiles is true replyProfiles.add(advisee.getProfile()); } } }
UpdateAttributesMessage getUpdateAttributesMessage(ReplyProcessor21 processor, Set recipients) { UpdateAttributesMessage msg = new UpdateAttributesMessage(); msg.adviseePath = this.advisee.getFullPath(); msg.setRecipients(recipients); if (processor != null) { msg.processorId = processor.getProcessorId(); } msg.profile = this.advisee.getProfile(); msg.exchangeProfiles = this.profileExchange; msg.removeProfile = this.removeProfile; return msg; }