Search in sources :

Example 1 with RemoteClusterListener

use of org.infinispan.notifications.cachelistener.cluster.RemoteClusterListener in project infinispan by infinispan.

the class CacheNotifierImpl method registerClusterListenerCallablesToInstall.

private void registerClusterListenerCallablesToInstall(Set<Object> enlistedAlready, Set<ClusterListenerReplicateCallable<K, V>> callables, List<CacheEntryListenerInvocation<K, V>> listenerInvocations) {
    for (CacheEntryListenerInvocation<K, V> listener : listenerInvocations) {
        if (!enlistedAlready.contains(listener.getTarget())) {
            // If clustered means it is local - so use our address
            if (listener.isClustered()) {
                Set<Class<? extends Annotation>> filterAnnotations = listener.getFilterAnnotations();
                callables.add(new ClusterListenerReplicateCallable(cache.wired().getName(), listener.getIdentifier(), rpcManager.getAddress(), listener.getFilter(), listener.getConverter(), listener.isSync(), filterAnnotations, listener.getKeyDataConversion(), listener.getValueDataConversion(), listener.useStorageFormat()));
                enlistedAlready.add(listener.getTarget());
            } else if (listener.getTarget() instanceof RemoteClusterListener) {
                RemoteClusterListener lcl = (RemoteClusterListener) listener.getTarget();
                Set<Class<? extends Annotation>> filterAnnotations = listener.getFilterAnnotations();
                callables.add(new ClusterListenerReplicateCallable(cache.wired().getName(), lcl.getId(), lcl.getOwnerAddress(), listener.getFilter(), listener.getConverter(), listener.isSync(), filterAnnotations, listener.getKeyDataConversion(), listener.getValueDataConversion(), listener.useStorageFormat()));
                enlistedAlready.add(listener.getTarget());
            }
        }
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ClusterListenerReplicateCallable(org.infinispan.notifications.cachelistener.cluster.ClusterListenerReplicateCallable) RemoteClusterListener(org.infinispan.notifications.cachelistener.cluster.RemoteClusterListener) Annotation(java.lang.annotation.Annotation)

Aggregations

Annotation (java.lang.annotation.Annotation)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ClusterListenerReplicateCallable (org.infinispan.notifications.cachelistener.cluster.ClusterListenerReplicateCallable)1 RemoteClusterListener (org.infinispan.notifications.cachelistener.cluster.RemoteClusterListener)1