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);
}
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());
}
Aggregations