Search in sources :

Example 1 with CuratorFramework

use of com.netflix.curator.framework.CuratorFramework in project storm by nathanmarz.

the class Utils method newCuratorStarted.

public static CuratorFramework newCuratorStarted(Map conf, List<String> servers, Object port) {
    CuratorFramework ret = newCurator(conf, servers, port);
    ret.start();
    return ret;
}
Also used : CuratorFramework(com.netflix.curator.framework.CuratorFramework)

Example 2 with CuratorFramework

use of com.netflix.curator.framework.CuratorFramework in project elasticsearch-river-kafka by endgameinc.

the class KafkaClientTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mockCurator = createMock(CuratorFramework.class);
    mockConsumer = createMock(SimpleConsumer.class);
    final CuratorFramework cur = mockCurator;
    final SimpleConsumer con = mockConsumer;
    client = new KafkaClient("zookeeper", "broker", 9092) {

        void connect(String zk, String broker, int port) {
            this.curator = cur;
            this.consumer = con;
        }
    };
}
Also used : CuratorFramework(com.netflix.curator.framework.CuratorFramework) SimpleConsumer(kafka.javaapi.consumer.SimpleConsumer)

Example 3 with CuratorFramework

use of com.netflix.curator.framework.CuratorFramework in project platformlayer by platformlayer.

the class ZookeeperContext method buildZk.

public CuratorFramework buildZk(List<String> dnsNames) throws OpsException {
    String connectionString = Joiner.on(",").join(dnsNames);
    Builder builder = CuratorFrameworkFactory.builder();
    builder.connectString(connectionString);
    TimeSpan retryInterval = TimeSpan.FIVE_SECONDS;
    RetryPolicy retryPolicy = new RetryOneTime((int) retryInterval.getTotalMilliseconds());
    builder.retryPolicy(retryPolicy);
    CuratorFramework curatorFramework;
    try {
        curatorFramework = builder.build();
    } catch (IOException e) {
        throw new OpsException("Error building zookeeper connection", e);
    }
    return curatorFramework;
// TimeSpan sessionTimeout = TimeSpan.TEN_SECONDS;
// 
// ZooKeeper zk = new ZooKeeper(connectionString, (int) sessionTimeout.getTotalMilliseconds(), this);
// return zk;
}
Also used : TimeSpan(com.fathomdb.TimeSpan) CuratorFramework(com.netflix.curator.framework.CuratorFramework) OpsException(org.platformlayer.ops.OpsException) RetryOneTime(com.netflix.curator.retry.RetryOneTime) Builder(com.netflix.curator.framework.CuratorFrameworkFactory.Builder) IOException(java.io.IOException) RetryPolicy(com.netflix.curator.RetryPolicy)

Example 4 with CuratorFramework

use of com.netflix.curator.framework.CuratorFramework in project storm by nathanmarz.

the class Utils method newCuratorStarted.

public static CuratorFramework newCuratorStarted(Map conf, List<String> servers, Object port, String root) {
    CuratorFramework ret = newCurator(conf, servers, port, root);
    ret.start();
    return ret;
}
Also used : CuratorFramework(com.netflix.curator.framework.CuratorFramework)

Aggregations

CuratorFramework (com.netflix.curator.framework.CuratorFramework)4 TimeSpan (com.fathomdb.TimeSpan)1 RetryPolicy (com.netflix.curator.RetryPolicy)1 Builder (com.netflix.curator.framework.CuratorFrameworkFactory.Builder)1 RetryOneTime (com.netflix.curator.retry.RetryOneTime)1 IOException (java.io.IOException)1 SimpleConsumer (kafka.javaapi.consumer.SimpleConsumer)1 OpsException (org.platformlayer.ops.OpsException)1