org.apache.zookeeper.server.ZKDatabase#close ( )源码实例Demo

下面列出了org.apache.zookeeper.server.ZKDatabase#close ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hadoop   文件: TestZKClient.java
@After
public void tearDown() throws IOException, InterruptedException {
  if (zks != null) {
    ZKDatabase zkDb = zks.getZKDatabase();
    factory.shutdown();
    try {
      zkDb.close();
    } catch (IOException ie) {
    }
    final int PORT = Integer.parseInt(hostPort.split(":")[1]);

    Assert.assertTrue("waiting for server down",
        waitForServerDown("127.0.0.1:" + PORT,
            CONNECTION_TIMEOUT));
  }

}
 
源代码2 项目: hadoop   文件: ClientBaseWithFixes.java
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);
        }
        final int PORT = getPort(hostPort);

        Assert.assertTrue("waiting for server down",
                   ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
                                                CONNECTION_TIMEOUT));
    }
}
 
源代码3 项目: big-c   文件: TestZKClient.java
@After
public void tearDown() throws IOException, InterruptedException {
  if (zks != null) {
    ZKDatabase zkDb = zks.getZKDatabase();
    factory.shutdown();
    try {
      zkDb.close();
    } catch (IOException ie) {
    }
    final int PORT = Integer.parseInt(hostPort.split(":")[1]);

    Assert.assertTrue("waiting for server down",
        waitForServerDown("127.0.0.1:" + PORT,
            CONNECTION_TIMEOUT));
  }

}
 
源代码4 项目: big-c   文件: ClientBaseWithFixes.java
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);
        }
        final int PORT = getPort(hostPort);

        Assert.assertTrue("waiting for server down",
                   ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
                                                CONNECTION_TIMEOUT));
    }
}
 
/** */
private void shutdownServerInstance(ServerCnxnFactory factory)
{
    if (factory != null) {
        ZKDatabase zkDb = null;
        {
            ZooKeeperServer zs = getServer(factory);
            if (zs != null)
                zkDb = zs.getZKDatabase();
        }
        factory.shutdown();
        try {
            if (zkDb != null)
                zkDb.close();
        } catch (IOException ie) {
            // ignore
        }
    }
}
 
源代码6 项目: lucene-solr   文件: ZkTestServer.java
/**
 * Shutdown the serving instance
 * @throws IOException If there is a low-level I/O error.
 */
protected void shutdown() throws IOException {

  // shutting down the cnxnFactory will close the zooKeeperServer
  // zooKeeperServer.shutdown();

  ZKDatabase zkDb = zooKeeperServer.getZKDatabase();
  try {
    if (cnxnFactory != null) {
      while (true) {
        cnxnFactory.shutdown();
        try {
          cnxnFactory.join();
          break;
        } catch (InterruptedException e) {
          // Thread.currentThread().interrupt();
          // don't keep interrupted status
        }
      }
    }
    if (zkDb != null) {
      zkDb.close();
    }

    if (cnxnFactory != null && cnxnFactory.getLocalPort() != 0) {
      waitForServerDown(getZkHost(), 30000);
    }
  } finally {

    ObjectReleaseTracker.release(this);
  }
}
 
 同类方法