Source:
<code>public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder) { ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory()); this.client = new CuratorZookeeperClient ( localZookeeperFactory, builder.getEnsembleProvider(), builder.getSessionTimeoutMs(), builder.getConnectionTimeoutMs(), new Watcher() { @Override public void process(WatchedEvent watchedEvent) { CuratorEvent event = new CuratorEventImpl ( CuratorFrameworkImpl.this, CuratorEventType.WATCHED, watchedEvent.getState().getIntValue(), unfixForNamespace(watchedEvent.getPath()), null, null, null, null, null, watchedEvent, null ); processEvent(event); } }, builder.getRetryPolicy(), builder.canBeReadOnly() ); listeners = new ListenerContainer<CuratorListener>(); unhandledErrorListeners = new ListenerContainer<UnhandledErrorListener>(); backgroundOperations = new DelayQueue<OperationAndData<?>>(); namespace = new NamespaceImpl(this, builder.getNamespace()); threadFactory = getThreadFactory(builder); connectionStateManager = new ConnectionStateManager(this, builder.getThreadFactory()); connectionState = new AtomicReference<ConnectionState>(null); compressionProvider = builder.getCompressionProvider(); aclProvider = builder.getAclProvider(); state = new AtomicReference<CuratorFrameworkState>(CuratorFrameworkState.LATENT); byte[] builderDefaultData = builder.getDefaultData(); defaultData = (builderDefaultData != null) ? Arrays.copyOf(builderDefaultData, builderDefaultData.length) : new byte[0]; if ( builder.getAuthScheme() != null ) { authInfo.set(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue())); } failedDeleteManager = new FailedDeleteManager(this); namespaceFacadeCache = new NamespaceFacadeCache(this); <START> getConnectionStateListenable().addListener(new ConnectionStateListener() <END> { @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { connectionState.set(newState); synchronized(connectionState) { connectionState.notifyAll(); } } }); }</code><technical_language>is this needed? exists in connectionStateManager</technical_language>

Target:
public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder) { ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory()); this.client = new CuratorZookeeperClient ( localZookeeperFactory, builder.getEnsembleProvider(), builder.getSessionTimeoutMs(), builder.getConnectionTimeoutMs(), new Watcher() { @Override public void process(WatchedEvent watchedEvent) { CuratorEvent event = new CuratorEventImpl ( CuratorFrameworkImpl.this, CuratorEventType.WATCHED, watchedEvent.getState().getIntValue(), unfixForNamespace(watchedEvent.getPath()), null, null, null, null, null, watchedEvent, null ); processEvent(event); } }, builder.getRetryPolicy(), builder.canBeReadOnly() ); listeners = new ListenerContainer<CuratorListener>(); unhandledErrorListeners = new ListenerContainer<UnhandledErrorListener>(); backgroundOperations = new DelayQueue<OperationAndData<?>>(); namespace = new NamespaceImpl(this, builder.getNamespace()); threadFactory = getThreadFactory(builder); connectionStateManager = new ConnectionStateManager(this, builder.getThreadFactory()); compressionProvider = builder.getCompressionProvider(); aclProvider = builder.getAclProvider(); state = new AtomicReference<CuratorFrameworkState>(CuratorFrameworkState.LATENT); byte[] builderDefaultData = builder.getDefaultData(); defaultData = (builderDefaultData != null) ? Arrays.copyOf(builderDefaultData, builderDefaultData.length) : new byte[0]; if ( builder.getAuthScheme() != null ) { authInfo.set(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue())); } failedDeleteManager = new FailedDeleteManager(this); namespaceFacadeCache = new NamespaceFacadeCache(this); getConnectionStateListenable().addListener(new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { if(newState.isConnected()) { synchronized(connectionLock) { connectionLock.notifyAll(); } } } }); }