34 lines
874 B
Java
34 lines
874 B
Java
|
package eu.mikroskeem.utils.etcdconnector;
|
||
|
|
||
|
import mousio.client.retry.RetryOnce;
|
||
|
import mousio.etcd4j.EtcdClient;
|
||
|
import org.slf4j.LoggerFactory;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.net.URI;
|
||
|
|
||
|
public class EtcdHTTPConnector extends EtcdConnectorBase implements EtcdConnector {
|
||
|
/**
|
||
|
* Sets up EtcdHTTPConnector against
|
||
|
* Etcd server with no encryption
|
||
|
*
|
||
|
* @param etcdUrls url(s) where to connect to
|
||
|
*/
|
||
|
public EtcdHTTPConnector(URI... etcdUrls) throws IOException {
|
||
|
super();
|
||
|
|
||
|
/* Set up logger */
|
||
|
logger = LoggerFactory.getLogger("EtcdConnector");
|
||
|
|
||
|
/* Initialize client */
|
||
|
initClient(etcdUrls);
|
||
|
|
||
|
/* Test client */
|
||
|
testEtcd();
|
||
|
}
|
||
|
|
||
|
@Override void initClient(URI... urls){
|
||
|
etcdClient = new EtcdClient(urls);
|
||
|
etcdClient.setRetryHandler(new RetryOnce(5000));
|
||
|
}
|
||
|
}
|