public <C> void addListener(Object listener, KeyValueFilter<? super K, ? super V> filter,
Converter<? super K, ? super V, C> converter, ClassLoader classLoader) {
Listener l = testListenerClassValidity(listener.getClass());
UUID generatedId = UUID.randomUUID();
CacheInvocationBuilder builder = new CacheInvocationBuilder();
CacheMode cacheMode = config.clustering().cacheMode();
builder.setClustered(l.clustered()).setOnlyPrimary(l.clustered() ? (cacheMode.isDistributed() ? true : false) : l.primaryOnly()).setFilter(filter).setConverter(converter)
.setIdentifier(generatedId).setIncludeCurrentState(l.includeCurrentState()).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();