public CuratorFramework newCurator ( ) { // Make all of the curator threads daemon threads so they don't block the JVM from terminating. Also label them // with the ensemble they're connecting to, in case someone is trying to sort through a thread dump. 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 ( ) ; }
Return a new Curator connection to the ensemble . It is the caller s responsibility to start and close the connection .