Java Code Examples for org.apache.zookeeper.server.ServerCnxnFactory#shutdown()

The following examples show how to use org.apache.zookeeper.server.ServerCnxnFactory#shutdown() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientBaseWithFixes.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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));
    }
}
 
Example 2
Source File: ClientBaseWithFixes.java    From big-c with Apache License 2.0 6 votes vote down vote up
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));
    }
}
 
Example 3
Source File: KafkaOperatorTestBase.java    From attic-apex-malhar with Apache License 2.0 6 votes vote down vote up
public static void stopZookeeper()
{
  for (ZooKeeperServer zs : zkServer) {
    if (zs != null) {
      zs.shutdown();
    }
  }

  for (ServerCnxnFactory zkf : zkFactory) {
    if (zkf != null) {
      zkf.closeAll();
      zkf.shutdown();
    }
  }
  zkServer = new ZooKeeperServer[2];
  zkFactory = new ServerCnxnFactory[2];
}
 
Example 4
Source File: KafkaOperatorTestBase.java    From attic-apex-malhar with Apache License 2.0 6 votes vote down vote up
public static void stopZookeeper()
{
  for (ZooKeeperServer zs : zkServer) {
    if (zs != null) {
      zs.shutdown();
    }
  }

  for (ServerCnxnFactory zkf : zkFactory) {
    if (zkf != null) {
      zkf.closeAll();
      zkf.shutdown();
    }
  }
  zkServer = new ZooKeeperServer[2];
  zkFactory = new ServerCnxnFactory[2];
}
 
Example 5
Source File: ZookeeperDiscoverySpiSaslAuthAbstractTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
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
        }
    }
}
 
Example 6
Source File: KafkaOperatorTestBase.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
public void stopZookeeper()
{
  for (ServerCnxnFactory zkf : zkFactory) {
    if (zkf != null) {
      zkf.shutdown();
    }
  }
}