Example #1
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        internal static ServerCnxnFactory CreateNewServerInstance(FilePath dataDir, ServerCnxnFactory
                                                                  factory, string hostPort, int maxCnxns)
        {
            ZooKeeperServer zks  = new ZooKeeperServer(dataDir, dataDir, 3000);
            int             Port = GetPort(hostPort);

            if (factory == null)
            {
                factory = ServerCnxnFactory.CreateFactory(Port, maxCnxns);
            }
            factory.Startup(zks);
            Assert.True("waiting for server up", ClientBaseWithFixes.WaitForServerUp
                            ("127.0.0.1:" + Port, ConnectionTimeout));
            return(factory);
        }
Example #2
0
 internal static void ShutdownServerInstance(ServerCnxnFactory factory, string hostPort
                                             )
 {
     if (factory != null)
     {
         ZKDatabase zkDb;
         {
             ZooKeeperServer zs = GetServer(factory);
             zkDb = zs.GetZKDatabase();
         }
         factory.Shutdown();
         try
         {
             zkDb.Close();
         }
         catch (IOException ie)
         {
             Log.Warn("Error closing logs ", ie);
         }
         int Port = GetPort(hostPort);
         Assert.True("waiting for server down", ClientBaseWithFixes.WaitForServerDown
                         ("127.0.0.1:" + Port, ConnectionTimeout));
     }
 }
Example #3
0
 internal NullWatcher(ClientBaseWithFixes _enclosing)
 {
     this._enclosing = _enclosing;
 }