*/
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter,
CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) {
Listener l = testListenerClassValidity(listener.getClass());
UUID generatedId = UUID.randomUUID();
CacheMode cacheMode = config.clustering().cacheMode();
CacheInvocationBuilder builder = new CacheInvocationBuilder();
builder
.setIncludeCurrentState(l.includeCurrentState())
.setClustered(l.clustered())
.setOnlyPrimary(l.clustered() ? (cacheMode.isDistributed() ? true : false) : l.primaryOnly())
.setFilter(filter)
.setConverter(converter)
.setIdentifier(generatedId)
.setClassLoader(classLoader);
boolean foundMethods = validateAndAddListenerInvocation(listener, builder);
if (foundMethods && l.clustered()) {
if (cacheMode.isInvalidation()) {
throw new UnsupportedOperationException("Cluster listeners cannot be used with Invalidation Caches!");
} else if (cacheMode.isDistributed()) {
clusterListenerIDs.put(listener, generatedId);
EmbeddedCacheManager manager = cache.getCacheManager();
Address ourAddress = manager.getAddress();
List<Address> members = manager.getMembers();