@Test public void testNewCurator() { ZooKeeperConfiguration config = parse(ImmutableMap.of("retryPolicy", ImmutableMap.builder() .put("type", "untilElapsed") .put("maxElapsedTimeMs", 1000) .put("sleepMsBetweenRetries", 50) .build())); CuratorFramework curator = config.newCurator(); assertNotNull(curator); assertEquals(CuratorFrameworkState.LATENT, curator.getState()); }
public CuratorFramework newCurator() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d") .setDaemon(true) .build(); org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse( (_configRetryPolicy != null) ? _configRetryPolicy : DEFAULT_RETRY_POLICY ); return CuratorFrameworkFactory.builder() .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING))) .retryPolicy(retry) .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds())) .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds())) .namespace(_namespace.orElse(null)) .threadFactory(threadFactory) .build(); }
ZooKeeperConfiguration { public CuratorFramework newCurator() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d") .setDaemon(true) .build(); org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse( (_configRetryPolicy != null) ? _configRetryPolicy : DEFAULT_RETRY_POLICY ); return CuratorFrameworkFactory.builder() .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING))) .retryPolicy(retry) .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds())) .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds())) .namespace(_namespace.orElse(null)) .threadFactory(threadFactory) .build(); } }
ZooKeeperConfiguration { public CuratorFramework newCurator() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d") .setDaemon(true) .build(); org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse( (_configRetryPolicy != null) ? _configRetryPolicy : DEFAULT_RETRY_POLICY ); return CuratorFrameworkFactory.builder() .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING))) .retryPolicy(retry) .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds())) .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds())) .namespace(_namespace.orElse(null)) .threadFactory(threadFactory) .build(); }  }
ZooKeeperConfiguration { public CuratorFramework newCurator() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d") .setDaemon(true) .build(); org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse( (_configRetryPolicy != null) ? _configRetryPolicy : DEFAULT_RETRY_POLICY ); return CuratorFrameworkFactory.builder() .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING))) .retryPolicy(retry) .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds())) .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds())) .namespace(_namespace.orElse(null)) .threadFactory(threadFactory) .build(); }  CuratorFramework newCurator(); @Deprecated CuratorFramework newManagedCurator(Environment env); CuratorFramework newManagedCurator(LifecycleEnvironment env); @JsonIgnore Optional<String> getConnectString(); @JsonIgnore Optional<String> getNamespace(); @JsonIgnore Optional<org.apache.curator.RetryPolicy> getRetryPolicy(); @JsonIgnore void setConnectString(String connectString); @JsonIgnore void setNamespace(String namespace); @JsonIgnore void setRetryPolicy(org.apache.curator.RetryPolicy retryPolicy); }
ZooKeeperConfiguration { public CuratorFramework newCurator() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d") .setDaemon(true) .build(); org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse( (_configRetryPolicy != null) ? _configRetryPolicy : DEFAULT_RETRY_POLICY ); return CuratorFrameworkFactory.builder() .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING))) .retryPolicy(retry) .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds())) .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds())) .namespace(_namespace.orElse(null)) .threadFactory(threadFactory) .build(); }  CuratorFramework newCurator(); @Deprecated CuratorFramework newManagedCurator(Environment env); CuratorFramework newManagedCurator(LifecycleEnvironment env); @JsonIgnore Optional<String> getConnectString(); @JsonIgnore Optional<String> getNamespace(); @JsonIgnore Optional<org.apache.curator.RetryPolicy> getRetryPolicy(); @JsonIgnore void setConnectString(String connectString); @JsonIgnore void setNamespace(String namespace); @JsonIgnore void setRetryPolicy(org.apache.curator.RetryPolicy retryPolicy);  }