@Override protected void profileRemoved(Profile profile) { if (logger.isDebugEnabled()) { logger.debug("CDA: removing profile {}", profile); } if (getAdvisee() instanceof LocalRegion && profile != null) { ((LocalRegion)getAdvisee()).removeMemberFromCriticalList(profile.getDistributedMember()); } }
@Override public String toString() { return "CacheDistributionAdvisor for region " + getAdvisee().getFullPath(); }
@Override public String toString() { return "CacheDistributionAdvisor for region " + getAdvisee().getFullPath(); }
@Override protected synchronized boolean basicAddProfile(Profile p) { boolean added = super.basicAddProfile(p); DistributionAdvisee advisee = getAdvisee(); if (advisee instanceof LocalRegion) { final Profile[] newProfiles = this.profiles; ((LocalRegion)advisee).profileAdded(this, p, newProfiles); } return added; }
@Override protected synchronized Profile basicRemoveMemberId(ProfileId id) { Profile removed = super.basicRemoveMemberId(id); if (removed != null) { DistributionAdvisee advisee = getAdvisee(); if (advisee instanceof LocalRegion) { final Profile[] remainingProfiles = this.profiles; ((LocalRegion)advisee).profileRemoved(this, removed, remainingProfiles); } } return removed; }
@Override protected void profileRemoved(Profile profile) { getLogWriter().fine("CDA: removing profile "+profile); if (getAdvisee() instanceof LocalRegion && profile != null) { ((LocalRegion)getAdvisee()).removeMemberFromCriticalList(profile.getDistributedMember()); } }
@Override protected boolean evaluateProfiles(Profile newProfile, Profile oldProfile) { boolean result = super.evaluateProfiles(newProfile, oldProfile); if (result) { CacheProfile newCP = (CacheProfile)newProfile; CacheProfile oldCP = (CacheProfile)oldProfile; if ((oldCP == null || !oldCP.regionInitialized) && newCP.regionInitialized) { // invoke membership listeners, if any CacheDistributionAdvisee advisee = (CacheDistributionAdvisee)getAdvisee(); advisee.remoteRegionInitialized(newCP); } } return result; }
@Override protected boolean evaluateProfiles(Profile newProfile, Profile oldProfile) { boolean result = super.evaluateProfiles(newProfile, oldProfile); if (result) { CacheProfile newCP = (CacheProfile)newProfile; CacheProfile oldCP = (CacheProfile)oldProfile; if ((oldCP == null || !oldCP.regionInitialized) && newCP.regionInitialized) { // invoke membership listeners, if any CacheDistributionAdvisee advisee = (CacheDistributionAdvisee)getAdvisee(); advisee.remoteRegionInitialized(newCP); } } return result; }
boolean isMetaDataWithTransactions = getAdvisee() instanceof LocalRegion && ((LocalRegion) getAdvisee()).isMetaRegionWithTransactions();
public Set adviseCacheServers() { getAdvisee().getCancelCriterion().checkCancelInProgress(null); return adviseFilter(new Filter() { public boolean include(Profile profile) { assert profile instanceof CacheProfile; CacheProfile cp = (CacheProfile)profile; return cp.hasCacheServer; } }); }
public Set adviseCacheServers() { getAdvisee().getCancelCriterion().checkCancelInProgress(null); return adviseFilter(new Filter() { public boolean include(Profile profile) { assert profile instanceof CacheProfile; CacheProfile cp = (CacheProfile)profile; return cp.hasCacheServer; } }); }
/** * Returns a the set of members that either want all events or are caching data. * @param excludeInRecovery if true then members in recovery are excluded */ private Set adviseAllEventsOrCached(final boolean excludeInRecovery) throws IllegalStateException { getAdvisee().getCancelCriterion().checkCancelInProgress(null); return adviseFilter(new Filter() { public boolean include(Profile profile) { assert profile instanceof CacheProfile; CacheProfile cp = (CacheProfile)profile; if (excludeInRecovery && cp.inRecovery) { return false; } return cp.cachedOrAllEventsWithListener(); } }); } /**
/** * Returns a the set of members that either want all events or are caching data. * @param excludeInRecovery if true then members in recovery are excluded */ private Set adviseAllEventsOrCached(final boolean excludeInRecovery) throws IllegalStateException { getAdvisee().getCancelCriterion().checkCancelInProgress(null); return adviseFilter(new Filter() { public boolean include(Profile profile) { assert profile instanceof CacheProfile; CacheProfile cp = (CacheProfile)profile; if (excludeInRecovery && cp.inRecovery) { return false; } return cp.cachedOrAllEventsWithListener(); } }); } /**
while(!membershipChanged && !isClosed) { checkInterruptedByShutdownAll(); advisor.getAdvisee().getCancelCriterion().checkCancelInProgress(null); this.wait(100); long time = System.nanoTime();
public void finishPendingDestroy() { //send a message to peers indicating that they should remove this profile long viewVersion = -1; viewVersion = advisor.startOperation(); try { if(logger.infoEnabled()) { advisor.getLogWriter().info(LocalizedStrings.DEBUG, "The advisee is " + advisor.getAdvisee()); } if (advisor.getAdvisee() != null && (advisor.getAdvisee() instanceof ProxyBucketRegion)) { ((ProxyBucketRegion)advisor.getAdvisee()).clearIndexes(advisor.getLogWriter()); } RemovePersistentMemberMessage.send(advisor.adviseProfileUpdate(), advisor.getDistributionManager(), regionPath, getPersistentID(), getInitializingID()); storage.finishPendingDestroy(); } finally { if (viewVersion != -1) { advisor.endOperation(viewVersion); } } synchronized(lock) { recoveredMembers.clear(); } }
if (!cp.regionInitialized) { RegionInfoShip regionInfo = new RegionInfoShip( ((CacheDistributionAdvisor)advisor).getAdvisee()); ((ArrayList<Object>)uninitializedRegions).add(regionInfo); ((CacheDistributionAdvisor)advisor).getAdvisee()); versionSources.put(regionInfo, cp.persistentID.diskStoreId); recipients.hasRegionDiskVersionSource = true;
public void waitForMembershipChange() throws InterruptedException { long waitThreshold = advisor.getDistributionManager().getConfig().getAckWaitThreshold(); // reduce the first log time from 15secs so that higher layers can report // sooner to user if (waitThreshold >= 5) { waitThreshold = waitThreshold / 5; } final long warningTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(waitThreshold); boolean warned = false; synchronized (this) { try { while (!membershipChanged && !isClosed && !doNotWait) { checkInterruptedByShutdownAll(); advisor.getAdvisee().getCancelCriterion().checkCancelInProgress(null); this.wait(100); if (!warned && System.currentTimeMillis() > warningTime) { //logWaitingForMember(allMembersToWaitFor, offlineMembersToWaitFor); advisor.getLogWriter().info(LocalizedStrings.DEBUG, "Waiting for atleast one server to come up."); //logWaitingForMember(); warned = true; } } this.membershipChanged = false; doNotWait = false; } finally { } } } }
while(!membershipChanged && !isClosed && !doNotWait) { checkInterruptedByShutdownAll(); advisor.getAdvisee().getCancelCriterion().checkCancelInProgress(null); this.wait(100); if(!warned && System.currentTimeMillis() > warningTime) {
CacheDistributionAdvisee advisee = (CacheDistributionAdvisee)getAdvisee(); if (advisee.getAttributes().getDataPolicy().withPersistence()) { isPersistent = true;
CacheDistributionAdvisee advisee = (CacheDistributionAdvisee)getAdvisee(); if (advisee.getAttributes().getDataPolicy().withPersistence()) { isPersistent = true;