Search in sources :

Example 1 with ClusterListener

use of org.keycloak.cluster.ClusterListener in project keycloak by keycloak.

the class InfinispanNotificationsManager method eventReceived.

private void eventReceived(String key, Serializable obj) {
    if (!(obj instanceof WrapperClusterEvent)) {
        if (obj == null) {
            logger.warnf("Event object wasn't available in remote cache after event was received. Event key: %s", key);
        }
        return;
    }
    WrapperClusterEvent event = (WrapperClusterEvent) obj;
    if (event.isIgnoreSender()) {
        if (this.myAddress.equals(event.getSender())) {
            return;
        }
    }
    if (event.isIgnoreSenderSite()) {
        if (this.mySite == null || this.mySite.equals(event.getSenderSite())) {
            return;
        }
    }
    String eventKey = event.getEventKey();
    if (logger.isTraceEnabled()) {
        logger.tracef("Received event: %s", event);
    }
    ClusterEvent wrappedEvent = event.getDelegateEvent();
    List<ClusterListener> myListeners = listeners.get(eventKey);
    if (myListeners != null) {
        for (ClusterListener listener : myListeners) {
            listener.eventReceived(wrappedEvent);
        }
    }
}
Also used : ClusterEvent(org.keycloak.cluster.ClusterEvent) ClusterListener(org.keycloak.cluster.ClusterListener)

Aggregations

ClusterEvent (org.keycloak.cluster.ClusterEvent)1 ClusterListener (org.keycloak.cluster.ClusterListener)1