@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()); } }
@Override public String toString() { return "CacheDistributionAdvisor for region " + getAdvisee().getFullPath(); }
@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() { @Override 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() { @Override public boolean include(Profile profile) { assert profile instanceof CacheProfile; CacheProfile cp = (CacheProfile) profile; if (excludeInRecovery && cp.inRecovery) { return false; } return cp.cachedOrAllEventsWithListener(); } }); }
private static BooleanSupplier cancelCondition(InternalPersistenceAdvisor persistenceAdvisor) { CancelCriterion cancelCriterion = persistenceAdvisor.getCacheDistributionAdvisor().getAdvisee().getCancelCriterion(); return () -> { persistenceAdvisor.checkInterruptedByShutdownAll(); cancelCriterion.checkCancelInProgress(null); return persistenceAdvisor.isClosed(); }; }
@Test(expected = CacheClosedException.class) public void propagatesException_ifCancelInProgress() { persistenceInitialImageAdvisor = persistenceInitialImageAdvisorWithDiskImage(); CancelCriterion cancelCriterion = mock(CancelCriterion.class); when(cacheDistributionAdvisor.getAdvisee().getCancelCriterion()).thenReturn(cancelCriterion); doThrow(new CacheClosedException()).when(cancelCriterion).checkCancelInProgress(any()); persistenceInitialImageAdvisor.getAdvice(null); }
try { while (!isClosed) { cacheDistributionAdvisor.getAdvisee().getCancelCriterion().checkCancelInProgress(null);
try { while (true) { cacheDistributionAdvisor.getAdvisee().getCancelCriterion().checkCancelInProgress(null); try {
CacheDistributionAdvisee advisee = (CacheDistributionAdvisee) getAdvisee(); if (advisee.getAttributes().getDataPolicy().withPersistence()) { isPersistent = true;