Search in sources :

Example 1 with ConnectionException

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException in project pinpoint by naver.

the class CuratorZookeeperClient method checkState.

private void checkState() throws PinpointZookeeperException {
    if (!isConnected()) {
        notConnectedStatus.update();
        if (reconnectCondition.check(notConnectedStatus)) {
            notConnectedStatus.reset();
            try {
                final org.apache.curator.CuratorZookeeperClient zookeeperClient = connectionManager.getCuratorFramework().getZookeeperClient();
                logger.warn("ConnectionState looks something wrong. It will be reset.");
                zookeeperClient.reset();
                return;
            } catch (Exception e) {
                logger.warn("Could not reset connection. cause:{}", e.getMessage(), e);
            }
        }
        final ConnectionState connectionState = connectionManager.getConnectionState();
        throw new ConnectionException("Instance must be connected. connectionState:" + connectionState);
    } else {
        notConnectedStatus.reset();
    }
}
Also used : ConnectionState(org.apache.curator.framework.state.ConnectionState) PinpointZookeeperException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException) KeeperException(org.apache.zookeeper.KeeperException) ConnectionException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException) ConnectionException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException)

Example 2 with ConnectionException

use of com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException in project pinpoint by pinpoint-apm.

the class CuratorZookeeperClient method checkState.

private void checkState() throws PinpointZookeeperException {
    if (!isConnected()) {
        notConnectedStatus.update();
        if (reconnectCondition.check(notConnectedStatus)) {
            notConnectedStatus.reset();
            try {
                final org.apache.curator.CuratorZookeeperClient zookeeperClient = connectionManager.getCuratorFramework().getZookeeperClient();
                logger.warn("ConnectionState looks something wrong. It will be reset.");
                zookeeperClient.reset();
                return;
            } catch (Exception e) {
                logger.warn("Could not reset connection. cause:{}", e.getMessage(), e);
            }
        }
        final ConnectionState connectionState = connectionManager.getConnectionState();
        throw new ConnectionException("Instance must be connected. connectionState:" + connectionState);
    } else {
        notConnectedStatus.reset();
    }
}
Also used : ConnectionState(org.apache.curator.framework.state.ConnectionState) PinpointZookeeperException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException) KeeperException(org.apache.zookeeper.KeeperException) ConnectionException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException) ConnectionException(com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException)

Aggregations

ConnectionException (com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException)2 PinpointZookeeperException (com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException)2 ConnectionState (org.apache.curator.framework.state.ConnectionState)2 KeeperException (org.apache.zookeeper.KeeperException)2