use of com.ctrip.xpipe.redis.meta.server.keeper.KeeperHeartBeatManager in project x-pipe by ctripcorp.
the class DefaultDynamicStateManager method remove.
@Override
public void remove(String clusterId) {
logger.info("[remote]{}", clusterId);
clusterMetas.remove(clusterId);
for (KeeperKey keeperKey : keepers.keySet()) {
if (keeperKey.getClusterId().equals(clusterId)) {
logger.info("[remove]{}", keeperKey);
KeeperHeartBeatManager keeperHeartBeatManager = keepers.remove(keeperKey);
keeperHeartBeatManager.close();
}
}
}
use of com.ctrip.xpipe.redis.meta.server.keeper.KeeperHeartBeatManager in project x-pipe by ctripcorp.
the class DefaultDynamicStateManager method add.
@Override
public void add(ClusterMeta clusterMeta) {
clusterMetas.put(clusterMeta.getId(), clusterMeta);
for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
for (KeeperMeta keeperMeta : shardMeta.getKeepers()) {
final KeeperKey keeperKey = createKeeperKey(clusterMeta.getId(), shardMeta.getId(), keeperMeta);
@SuppressWarnings("unused") KeeperHeartBeatManager keeperHeartBeatManager = MapUtils.getOrCreate(keepers, keeperKey, new ObjectFactory<KeeperHeartBeatManager>() {
@Override
public KeeperHeartBeatManager create() {
KeeperHeartBeatManager keeperHeartBeatManager = new DefaultKeeperHeartBeatManager(keeperKey, scheduled);
keeperHeartBeatManager.addObserver(DefaultDynamicStateManager.this);
return keeperHeartBeatManager;
}
});
}
}
}
use of com.ctrip.xpipe.redis.meta.server.keeper.KeeperHeartBeatManager in project x-pipe by ctripcorp.
the class DefaultDynamicStateManager method ping.
@Override
public void ping(KeeperInstanceMeta keeperInstanceMeta) {
final KeeperKey keeperKey = createKeeperKey(keeperInstanceMeta);
logger.debug("[ping]{}", keeperKey);
KeeperHeartBeatManager keeperHeartBeatManager = keepers.get(keeperKey);
if (keeperHeartBeatManager == null) {
logger.error("[ping][error, not this cluster]{}", keeperKey);
return;
}
keeperHeartBeatManager.ping(keeperInstanceMeta);
}
Aggregations