Class ZooKeeperUpdatingListenerBuilder


  • public final class ZooKeeperUpdatingListenerBuilder
    extends Object
    Builds a new ZooKeeperUpdatingListener, which registers the server to a ZooKeeper cluster.

    Examples

    
     ZooKeeperUpdatingListener listener =
         new ZooKeeperUpdatingListenerBuilder("myZooKeeperHost:2181", "/myProductionEndpoints")
             .sessionTimeoutMillis(10000)
             .nodeValueCodec(NodeValueCodec.DEFAULT)
             .build();
     ServerBuilder sb = new ServerBuilder();
     sb.addListener(listener);
     

    You can also specify the CuratorFramework instance to use. In this case, invoking connectTimeout(Duration), connectTimeoutMillis(long), sessionTimeout(Duration) or sessionTimeoutMillis(long) will raise an IllegalStateException.

    
     ZooKeeperUpdatingListener listener =
         new ZooKeeperUpdatingListenerBuilder(curatorFramework, "/myProductionEndpoints")
             .nodeValueCodec(NodeValueCodec.DEFAULT)
             .build();
     ServerBuilder sb = new ServerBuilder();
     sb.addListener(listener);