Source:
<code>public Void call() throws Exception { if (!ourAddress.equals(origin)) { if (cacheManager.getMembers().contains(origin)) { synchronized (cacheNotifier) { boolean alreadyInstalled = false; for (Object installedListener : cacheNotifier.getListeners()) { if (installedListener instanceof LocalClusterListener && identifier.equals(((LocalClusterListener)installedListener).getId())) { alreadyInstalled = true; break; } } if (!alreadyInstalled) { LocalClusterListener listener = new LocalClusterListener(identifier, origin, distExecutor, cacheNotifier, cacheManagerNotifier); cacheNotifier.addListener(listener, filter, converter); <START> cacheManagerNotifier.addListener(listener); <END> if (!cacheManager.getMembers().contains(origin)) { cacheNotifier.removeListener(listener); cacheManagerNotifier.removeListener(listener); log.tracef("Removing local cluster listener for remote cluster listener that was just registered, as the origin %s went away concurrently", origin); } else { log.tracef("Registered local cluster listener for remote cluster listener from origin %s with id %s", origin, identifier); } } else { log.tracef("Local cluster listener from origin %s with id % was already installed, ignoring", origin, identifier); } } } else { log.tracef("Not registering local cluster listener for remote cluster listener from origin %s, as the origin went away", origin); } } else { log.trace("Not registering local cluster listener as we are the node who registered the cluster listener"); } return null; }</code><technical_language>a cache manager-level clustered listener</technical_language>

Target:
public Void call() throws Exception { if (!ourAddress.equals(origin)) { if (cacheManager.getMembers().contains(origin)) { synchronized (cacheNotifier) { boolean alreadyInstalled = false; for (Object installedListener : cacheNotifier.getListeners()) { if (installedListener instanceof RemoteClusterListener && identifier.equals(((RemoteClusterListener)installedListener).getId())) { alreadyInstalled = true; break; } } if (!alreadyInstalled) { RemoteClusterListener listener = new RemoteClusterListener(identifier, origin, distExecutor, cacheNotifier, cacheManagerNotifier); cacheNotifier.addListener(listener, filter, converter); cacheManagerNotifier.addListener(listener); if (!cacheManager.getMembers().contains(origin)) { cacheNotifier.removeListener(listener); cacheManagerNotifier.removeListener(listener); if (log.isTraceEnabled()) { log.tracef("Removing local cluster listener for remote cluster listener that was just registered, as the origin %s went away concurrently", origin); } } else if (log.isTraceEnabled()) { log.tracef("Registered local cluster listener for remote cluster listener from origin %s with id %s", origin, identifier); } } else if (log.isTraceEnabled()) { log.tracef("Local cluster listener from origin %s with id % was already installed, ignoring", origin, identifier); } } } else if (log.isTraceEnabled()) { log.tracef("Not registering local cluster listener for remote cluster listener from origin %s, as the origin went away", origin); } } else if (log.isTraceEnabled()) { log.trace("Not registering local cluster listener as we are the node who registered the cluster listener"); } return null; }