use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException in project pinpoint by naver.
the class CuratorZookeeperClient method delete.
@Override
public void delete(String path) throws PinpointZookeeperException {
checkState();
assertPathHasLength(path);
logger.debug("delete() started. path:{}", path);
try {
CuratorFramework curator = connectionManager.getCuratorFramework();
curator.delete().forPath(path);
} catch (KeeperException.NoNodeException noNode) {
// skip
} catch (Exception e) {
ZookeeperExceptionResolver.resolveAndThrow(e);
}
}
use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException in project pinpoint by naver.
the class CuratorZookeeperClient method getData.
@Override
public byte[] getData(String path, boolean watch) throws PinpointZookeeperException {
checkState();
assertPathHasLength(path);
logger.debug("getData() started. path:{}, watch:{}", path, watch);
try {
CuratorFramework curator = connectionManager.getCuratorFramework();
final GetDataBuilder data = curator.getData();
if (watch) {
return data.usingWatcher(zookeeperEventWatcher).forPath(path);
} else {
return data.forPath(path);
}
} catch (Exception e) {
throw ZookeeperExceptionResolver.resolve(e);
}
}
use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException 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.");
}
}
use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException in project pinpoint by naver.
the class ZookeeperClusterDataManager method start.
@Override
public void start() {
this.timer = createTimer();
this.client = new CuratorZookeeperClient(connectAddress, sessionTimeout, this);
try {
this.client.connect();
} catch (PinpointZookeeperException e) {
throw new RuntimeException("ZookeeperClient connect failed", e);
}
if (periodicSyncTask != null) {
this.timer.newTimeout(periodicSyncTask, periodicSyncTask.getIntervalMillis(), TimeUnit.MILLISECONDS);
}
}
Aggregations