Search in sources :

Example 1 with ClientStoreConnectionVerifier

use of voldemort.cluster.failuredetector.ClientStoreConnectionVerifier in project voldemort by voldemort.

the class SocketStoreClientFactory method initFailureDetector.

@Override
protected FailureDetector initFailureDetector(final ClientConfig config, Cluster cluster) {
    failureDetectorListener = new FailureDetectorListener() {

        public void nodeAvailable(Node node) {
        }

        public void nodeUnavailable(Node node) {
            if (logger.isInfoEnabled())
                logger.info(node + " has been marked as unavailable, destroying socket pool");
            // Kill the socket pool for this node...
            SocketDestination destination = new SocketDestination(node.getHost(), node.getSocketPort(), config.getRequestFormatType());
            storeFactory.close(destination);
        }
    };
    ClientStoreConnectionVerifier verifier = new ClientStoreConnectionVerifier() {

        @Override
        protected Store<ByteArray, byte[], byte[]> getStoreInternal(Node node) {
            logger.debug("Returning a new store verifier for node: " + node);
            return SocketStoreClientFactory.this.getStore(MetadataStore.METADATA_STORE_NAME, node.getHost(), node.getSocketPort(), config.getRequestFormatType());
        }
    };
    FailureDetectorConfig failureDetectorConfig = new FailureDetectorConfig(config).setCluster(cluster).setConnectionVerifier(verifier);
    return create(failureDetectorConfig, false, failureDetectorListener);
}
Also used : FailureDetectorListener(voldemort.cluster.failuredetector.FailureDetectorListener) SocketDestination(voldemort.store.socket.SocketDestination) Node(voldemort.cluster.Node) FailureDetectorConfig(voldemort.cluster.failuredetector.FailureDetectorConfig) ClientStoreConnectionVerifier(voldemort.cluster.failuredetector.ClientStoreConnectionVerifier) ByteArray(voldemort.utils.ByteArray)

Example 2 with ClientStoreConnectionVerifier

use of voldemort.cluster.failuredetector.ClientStoreConnectionVerifier in project voldemort by voldemort.

the class HttpStoreClientFactory method initFailureDetector.

@Override
protected FailureDetector initFailureDetector(final ClientConfig config, Cluster cluster) {
    ClientStoreConnectionVerifier verifier = new ClientStoreConnectionVerifier() {

        @Override
        protected Store<ByteArray, byte[], byte[]> getStoreInternal(Node node) {
            return HttpStoreClientFactory.this.getStore(MetadataStore.METADATA_STORE_NAME, node.getHost(), node.getHttpPort(), config.getRequestFormatType());
        }
    };
    FailureDetectorConfig failureDetectorConfig = new FailureDetectorConfig(config).setCluster(cluster).setConnectionVerifier(verifier);
    return create(failureDetectorConfig, config.isJmxEnabled());
}
Also used : Node(voldemort.cluster.Node) FailureDetectorConfig(voldemort.cluster.failuredetector.FailureDetectorConfig) ClientStoreConnectionVerifier(voldemort.cluster.failuredetector.ClientStoreConnectionVerifier) ByteArray(voldemort.utils.ByteArray)

Aggregations

Node (voldemort.cluster.Node)2 ClientStoreConnectionVerifier (voldemort.cluster.failuredetector.ClientStoreConnectionVerifier)2 FailureDetectorConfig (voldemort.cluster.failuredetector.FailureDetectorConfig)2 ByteArray (voldemort.utils.ByteArray)2 FailureDetectorListener (voldemort.cluster.failuredetector.FailureDetectorListener)1 SocketDestination (voldemort.store.socket.SocketDestination)1