Search in sources :

Example 1 with CommonState

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState in project pinpoint by naver.

the class FlinkClusterService method tearDown.

@PreDestroy
public void tearDown() {
    if (!config.isFlinkClusterEnable()) {
        logger.info("flink cluster disable.");
        return;
    }
    if (!(this.serviceState.changeStateDestroying())) {
        CommonState state = this.serviceState.getCurrentState();
        logger.info("{} already {}.", this.getClass().getSimpleName(), state.toString());
        return;
    }
    logger.info("{} destroying started.", this.getClass().getSimpleName());
    if (this.zookeeperClusterManager != null) {
        zookeeperClusterManager.stop();
    }
    if (client != null) {
        client.close();
    }
    this.serviceState.changeStateStopped();
    logger.info("{} destroying completed.", this.getClass().getSimpleName());
}
Also used : CommonState(com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState) PreDestroy(javax.annotation.PreDestroy)

Example 2 with CommonState

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState in project pinpoint by naver.

the class ZookeeperClusterService method tearDown.

@Override
public void tearDown() {
    logger.info("pinpoint-collector cluster tearDown");
    if (!(this.serviceState.changeStateDestroying())) {
        CommonState state = this.serviceState.getCurrentState();
        logger.info("{} already {}.", this.getClass().getSimpleName(), state);
        return;
    }
    logger.info("{} destroying started.", this.getClass().getSimpleName());
    if (this.profilerClusterManager != null) {
        profilerClusterManager.stop();
    }
    if (this.webClusterManager != null) {
        webClusterManager.stop();
    }
    if (client != null) {
        client.close();
    }
    if (clusterConnectionManager != null) {
        clusterConnectionManager.stop();
    }
    this.serviceState.changeStateStopped();
    logger.info("{} destroying completed.", this.getClass().getSimpleName());
}
Also used : CommonState(com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)

Example 3 with CommonState

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState in project pinpoint by naver.

the class ZookeeperClusterManager method stop.

public void stop() {
    if (!(this.workerState.changeStateDestroying())) {
        CommonState state = this.workerState.getCurrentState();
        logger.info("{} already {}.", this.getClass().getSimpleName(), state);
        return;
    }
    logger.info("{} destroying started.", this.getClass().getSimpleName());
    if (clusterConnectionManager != null) {
        clusterConnectionManager.stop();
    }
    final boolean stopOffer = queue.offer(stopTask);
    if (!stopOffer) {
        logger.warn("Insert stopTask failed.");
    }
    boolean interrupted = false;
    while (this.workerThread.isAlive()) {
        this.workerThread.interrupt();
        try {
            this.workerThread.join(100L);
        } catch (InterruptedException e) {
            interrupted = true;
        }
    }
    this.workerState.changeStateStopped();
    logger.info("{} destroying completed.", this.getClass().getSimpleName());
}
Also used : CommonState(com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)

Example 4 with CommonState

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState in project pinpoint by naver.

the class ZookeeperClusterManager method handleAndRegisterWatcher.

public void handleAndRegisterWatcher(String path) {
    if (workerState.isStarted()) {
        if (parentPath.equals(path) || parentPath.equals(path + ZookeeperConstants.PATH_SEPARATOR)) {
            final boolean offerSuccess = queue.offer(getAndRegisterTask);
            if (!offerSuccess) {
                logger.info("Message Queue is Full.");
            }
        } else {
            logger.info("Invalid Path {}.", path);
        }
    } else {
        CommonState state = this.workerState.getCurrentState();
        logger.info("{} invalid state {}.", this.getClass().getSimpleName(), state);
    }
}
Also used : CommonState(com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)

Aggregations

CommonState (com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)4 PreDestroy (javax.annotation.PreDestroy)1