use of com.navercorp.pinpoint.collector.cluster.zookeeper.ZookeeperClusterManager in project pinpoint by naver.
the class FlinkClusterService method setUp.
@PostConstruct
public void setUp() {
if (!config.isFlinkClusterEnable()) {
logger.info("flink cluster disable.");
return;
}
switch(this.serviceState.getCurrentState()) {
case NEW:
if (this.serviceState.changeStateInitializing()) {
logger.info("{} initialization started.", this.getClass().getSimpleName());
ClusterManagerWatcher watcher = new ClusterManagerWatcher(pinpointFlinkClusterPath);
this.client = new CuratorZookeeperClient(config.getFlinkClusterZookeeperAddress(), config.getFlinkClusterSessionTimeout(), watcher);
try {
this.client.connect();
} catch (PinpointZookeeperException e) {
throw new RuntimeException("ZookeeperClient connect failed", e);
}
this.zookeeperClusterManager = new ZookeeperClusterManager(client, pinpointFlinkClusterPath, clusterConnectionManager);
this.zookeeperClusterManager.start();
this.serviceState.changeStateStarted();
logger.info("{} initialization completed.", this.getClass().getSimpleName());
if (client.isConnected()) {
watcher.handleConnected();
}
}
break;
case INITIALIZING:
logger.info("{} already initializing.", this.getClass().getSimpleName());
break;
case STARTED:
logger.info("{} already started.", this.getClass().getSimpleName());
break;
case DESTROYING:
throw new IllegalStateException("Already destroying.");
case STOPPED:
throw new IllegalStateException("Already stopped.");
case ILLEGAL_STATE:
throw new IllegalStateException("Invalid State.");
}
}
Aggregations