public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
        {
            IZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.GetZookeeperFactory());
            this.client = new CuratorZookeeperClient(localZookeeperFactory,
                                                        builder.GetEnsembleProvider(),
                                                        builder.GetSessionTimeoutMs(),
                                                        builder.GetConnectionTimeoutMs(),
                                                        new WatchedWatcher(this),
                                                        builder.GetRetryPolicy(),
                                                        builder.CanBeReadOnly());

            listeners = new ListenerContainer<ICuratorListener>();
            unhandledErrorListeners = new ListenerContainer<IUnhandledErrorListener>();
            backgroundOperations = new DelayQueue<OperationAndData<object>>();
            @namespace = new NamespaceImpl(this, builder.GetNamespace());
            maxCloseWaitMs = builder.GetMaxCloseWaitMs();
            connectionStateManager = new ConnectionStateManager(this, builder.GetEventQueueSize());
            compressionProvider = builder.GetCompressionProvider();
            aclProvider = builder.GetAclProvider();
            state = new AtomicReference<CuratorFrameworkState>(CuratorFrameworkState.LATENT);
            useContainerParentsIfAvailable = builder.UseContainerParentsIfAvailable();

            byte[] builderDefaultData = builder.GetDefaultData();
            byte[] destDefaults = new byte[builderDefaultData.Length];
            Array.Copy(builderDefaultData, destDefaults, builderDefaultData.Length);
            defaultData = (builderDefaultData != null)
                            ?  destDefaults
                            : new byte[0];
            authInfos = buildAuths(builder);

            failedDeleteManager = new FailedDeleteManager(this);
            namespaceWatcherMap = new NamespaceWatcherMap(this);
            namespaceFacadeCache = new NamespaceFacadeCache(this);
        }
 protected CuratorFrameworkImpl(CuratorFrameworkImpl parent)
 {
     client = parent.client;
     listeners = parent.listeners;
     unhandledErrorListeners = parent.unhandledErrorListeners;
     maxCloseWaitMs = parent.maxCloseWaitMs;
     backgroundOperations = parent.backgroundOperations;
     connectionStateManager = parent.connectionStateManager;
     defaultData = parent.defaultData;
     failedDeleteManager = parent.failedDeleteManager;
     compressionProvider = parent.compressionProvider;
     aclProvider = parent.aclProvider;
     namespaceFacadeCache = parent.namespaceFacadeCache;
     @namespace = new NamespaceImpl(this, null);
     state = parent.state;
     authInfos = parent.authInfos;
     _useContainerParentsIfAvailable = parent._useContainerParentsIfAvailable;
 }