Search in sources :

Example 1 with MetaComparator

use of com.ctrip.xpipe.redis.core.meta.MetaComparator in project x-pipe by ctripcorp.

the class DefaultCurrentMetaManager method dcMetaChange.

private void dcMetaChange(DcMetaComparator comparator) {
    for (ClusterMeta clusterMeta : comparator.getAdded()) {
        if (currentClusterServer.hasKey(clusterMeta.getId())) {
            addCluster(clusterMeta.getId());
        } else {
            logger.info("[dcMetaChange][add][not interested]{}", clusterMeta.getId());
        }
    }
    for (ClusterMeta clusterMeta : comparator.getRemoved()) {
        if (currentClusterServer.hasKey(clusterMeta.getId())) {
            destroyCluster(clusterMeta);
        } else {
            logger.info("[dcMetaChange][destroy][not interested]{}", clusterMeta.getId());
        }
    }
    for (@SuppressWarnings("rawtypes") MetaComparator changedComparator : comparator.getMofified()) {
        ClusterMetaComparator clusterMetaComparator = (ClusterMetaComparator) changedComparator;
        String clusterId = clusterMetaComparator.getCurrent().getId();
        if (currentClusterServer.hasKey(clusterId)) {
            handleClusterChanged(clusterMetaComparator);
        } else {
            logger.info("[dcMetaChange][change][not interested]{}", clusterId);
        }
    }
}
Also used : ClusterMetaComparator(com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator) ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) ClusterMetaComparator(com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator) MetaComparator(com.ctrip.xpipe.redis.core.meta.MetaComparator) DcMetaComparator(com.ctrip.xpipe.redis.core.meta.comparator.DcMetaComparator)

Aggregations

ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)1 MetaComparator (com.ctrip.xpipe.redis.core.meta.MetaComparator)1 ClusterMetaComparator (com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator)1 DcMetaComparator (com.ctrip.xpipe.redis.core.meta.comparator.DcMetaComparator)1