Search in sources :

Example 1 with NodeDeleted

use of com.ctrip.xpipe.observer.NodeDeleted in project x-pipe by ctripcorp.

the class AbstractCurrentMetaObserver method update.

@SuppressWarnings("rawtypes")
@Override
public void update(Object args, Observable observable) {
    if (args instanceof NodeAdded) {
        ClusterMeta clusterMeta = (ClusterMeta) ((NodeAdded) args).getNode();
        logger.info("[update][add][{}]{}", getClass().getSimpleName(), clusterMeta.getId());
        handleClusterAdd(clusterMeta);
        return;
    }
    if (args instanceof NodeDeleted) {
        ClusterMeta clusterMeta = (ClusterMeta) ((NodeDeleted) args).getNode();
        logger.info("[update][delete][{}]{}", getClass().getSimpleName(), clusterMeta.getId());
        handleClusterDeleted(clusterMeta);
        return;
    }
    if (args instanceof ClusterMetaComparator) {
        ClusterMetaComparator clusterMetaComparator = (ClusterMetaComparator) args;
        logger.info("[update][modify][{}]{}", getClass().getSimpleName(), clusterMetaComparator);
        handleClusterModified(clusterMetaComparator);
        return;
    }
    throw new IllegalArgumentException("unknown argument:" + args);
}
Also used : ClusterMetaComparator(com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator) ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) NodeAdded(com.ctrip.xpipe.observer.NodeAdded) NodeDeleted(com.ctrip.xpipe.observer.NodeDeleted)

Aggregations

NodeAdded (com.ctrip.xpipe.observer.NodeAdded)1 NodeDeleted (com.ctrip.xpipe.observer.NodeDeleted)1 ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)1 ClusterMetaComparator (com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator)1