Esempio n. 1
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        protected internal virtual TestableZooKeeper CreateClient(ClientBaseWithFixes.CountdownWatcher
                                                                  watcher, string hp, int timeout)
        {
            watcher.Reset();
            TestableZooKeeper zk = new TestableZooKeeper(hp, timeout, watcher);

            if (!watcher.clientConnected.Await(timeout, TimeUnit.Milliseconds))
            {
                NUnit.Framework.Assert.Fail("Unable to connect to server");
            }
            lock (this)
            {
                if (!allClientsSetup)
                {
                    Log.Error("allClients never setup");
                    NUnit.Framework.Assert.Fail("allClients never setup");
                }
                if (allClients != null)
                {
                    allClients.AddItem(zk);
                }
                else
                {
                    // test done - close the zk, not needed
                    zk.Close();
                }
            }
            watcher.InitializeWatchedClient(zk);
            return(zk);
        }
Esempio n. 2
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="System.Exception"/>
 protected internal virtual TestableZooKeeper CreateClient(ClientBaseWithFixes.CountdownWatcher
                                                           watcher, string hp)
 {
     return(CreateClient(watcher, hp, ConnectionTimeout));
 }
Esempio n. 3
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="System.Exception"/>
 protected internal virtual TestableZooKeeper CreateClient(string hp)
 {
     ClientBaseWithFixes.CountdownWatcher watcher = new ClientBaseWithFixes.CountdownWatcher
                                                        ();
     return(CreateClient(watcher, hp));
 }