예제 #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);
        }
예제 #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));
     }
 }
예제 #3
0
 internal NullWatcher(ClientBaseWithFixes _enclosing)
 {
     this._enclosing = _enclosing;
 }