class CacheDistributionAdvisor extends DistributionAdvisor {

  Set<InternalDistributedMember> adviseAllEventsOrCached()
      throws IllegalStateException {
    getAdvisee().getCancelCriterion().checkCancelInProgress(null);

    // minimize volatile reads by copying ref to local var
    long tempProfilesVersion = profilesVersion; // volatile read
    long tempInRecoveryVersion = inRecoveryVersion; // volatile read

    if (adviseAllEventsVersion != tempProfilesVersion
        || adviseInRecoveryVersion != tempInRecoveryVersion) {
      synchronized (adviseSetforAllEvents) {
        if (adviseAllEventsVersion != tempProfilesVersion
            || adviseInRecoveryVersion != tempInRecoveryVersion) {

          adviseSetforAllEvents = Collections.unmodifiableSet(adviseFilter(profile -> {
            CacheProfile cp = (CacheProfile) profile;
            if (cp.getInRecovery()) {
              return false;
            }
            return cp.cachedOrAllEventsWithListener();
          }));
          adviseAllEventsVersion = tempProfilesVersion;
          adviseInRecoveryVersion = tempInRecoveryVersion;
        }
      }
    }
    return adviseSetforAllEvents;

  }

  protected  CacheDistributionAdvisor(CacheDistributionAdvisee region);

}