gpt4 book ai didi

org.apache.zookeeper.server.ZooKeeperServer.shutdown()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 05:54:40 24 4
gpt4 key购买 nike

本文整理了Java中org.apache.zookeeper.server.ZooKeeperServer.shutdown()方法的一些代码示例,展示了ZooKeeperServer.shutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServer.shutdown()方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServer
类名称:ZooKeeperServer
方法名:shutdown

ZooKeeperServer.shutdown介绍

[英]Shut down the server instance
[中]关闭服务器实例

代码示例

代码示例来源:origin: apache/zookeeper

public void shutdown() {
  shutdown(false);
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

public void shutdown() {
  shutdown(false);
}

代码示例来源:origin: apache/zookeeper

public void shutdown() {
  try {
    // close listen socket and signal selector threads to stop
    stop();
    // wait for selector and worker threads to shutdown
    join();
    // close all open connections
    closeAll();
    if (login != null) {
      login.shutdown();
    }
  } catch (InterruptedException e) {
    LOG.warn("Ignoring interrupted exception during shutdown", e);
  } catch (Exception e) {
    LOG.warn("Ignoring unexpected exception during shutdown", e);
  }
  if (zkServer != null) {
    zkServer.shutdown();
  }
}

代码示例来源:origin: apache/zookeeper

@Override
public synchronized void shutdown() {
  if (!canShutdown()) {
    LOG.debug("ZooKeeper server is not running, so not proceeding to shutdown!");
    return;
  }
  shutdown = true;
  unregisterJMX(this);
  // set peer's server to null
  self.setZooKeeperServer(null);
  // clear all the connections
  self.closeAllConnections();
  self.adminServer.setZooKeeperServer(null);
  // shutdown the server itself
  super.shutdown();
}

代码示例来源:origin: apache/zookeeper

zkServer.shutdown();

代码示例来源:origin: apache/zookeeper

@After
public void teardown() throws Exception {
  if (servcnxnf != null) {
    servcnxnf.shutdown();
  }
  if (zks != null) {
    zks.shutdown();
  }
}

代码示例来源:origin: prestodb/presto

@Override
public void close()
    throws IOException
{
  if (started.get() && !stopped.getAndSet(true)) {
    cnxnFactory.shutdown();
    try {
      cnxnFactory.join();
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
    if (zkServer.isRunning()) {
      zkServer.shutdown();
    }
    deleteRecursively(zkDataDir.toPath(), ALLOW_INSECURE);
  }
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

@Override
public void shutdown() {
  LOG.info("shutdown called " + localAddress);
  if (login != null) {
    login.shutdown();
  }
  // null if factory never started
  if (parentChannel != null) {
    parentChannel.close().awaitUninterruptibly();
    closeAll();
    allChannels.close().awaitUninterruptibly();
    bootstrap.releaseExternalResources();
  }
  if (zkServer != null) {
    zkServer.shutdown();
  }
  synchronized(this) {
    killed = true;
    notifyAll();
  }
}

代码示例来源:origin: apache/zookeeper

@After
public void tearDown() throws Exception {
  serverFactory.shutdown();
  zs.shutdown();
  Assert.assertTrue("waiting for server down",
        ClientBase.waitForServerDown(HOSTPORT,
                      CONNECTION_TIMEOUT));
}

代码示例来源:origin: apache/zookeeper

@After
public void teardown() throws Exception {
  // count down to avoid infinite blocking call due to this latch, if
  // any.
  startupDelayLatch.countDown();
  if (servcnxnf != null) {
    servcnxnf.shutdown();
  }
  if (zks != null) {
    zks.shutdown();
  }
  if (zks.getZKDatabase() != null) {
    zks.getZKDatabase().close();
  }
  ClientBase.recursiveDelete(tmpDir);
}

代码示例来源:origin: apache/zookeeper

zks.shutdown();
Assert.assertTrue("waiting for server down",
      ClientBase.waitForServerDown(HOSTPORT,

代码示例来源:origin: apache/zookeeper

/**
   * ZOOKEEPER-1573: test restoring a snapshot with deleted txns ahead of the
   * snapshot file's zxid.
   */
  @Test
  public void testReloadSnapshotWithMissingParent() throws Exception {
    // create transactions to create the snapshot with create/delete pattern
    ZooKeeper zk = createZKClient(hostPort);
    zk.create("/a", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
        CreateMode.PERSISTENT);
    Stat stat = zk.exists("/a", false);
    long createZxId = stat.getMzxid();
    zk.create("/a/b", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
        CreateMode.PERSISTENT);
    zk.delete("/a/b", -1);
    zk.delete("/a", -1);
    // force the zxid to be behind the content
    ZooKeeperServer zks = getServer(serverFactory);
    zks.getZKDatabase().setlastProcessedZxid(createZxId);
    LOG.info("Set lastProcessedZxid to {}", zks.getZKDatabase()
        .getDataTreeLastProcessedZxid());
    // Force snapshot and restore
    zks.takeSnapshot();
    zks.shutdown();
    stopServer();

    startServer();
  }
}

代码示例来源:origin: apache/zookeeper

zk.close();
f.shutdown();
zks.shutdown();
Assert.assertTrue("waiting for server down",
    ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT));

代码示例来源:origin: apache/zookeeper

zk.close();
f.shutdown();
zks.shutdown();
Assert.assertTrue("waiting for server down",
    ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT));

代码示例来源:origin: apache/zookeeper

zks.shutdown();
Assert.assertTrue("waiting for server to shutdown",
    ClientBase.waitForServerDown(HOSTPORT, CONNECTION_TIMEOUT));
LOG.info("committedLog size = {}", logsize);
Assert.assertTrue("log size != 0", (logsize != 0));
zks.shutdown();

代码示例来源:origin: apache/zookeeper

@Test
public void testDisconnectedAddAuth() throws Exception {
  File tmpDir = ClientBase.createTmpDir();
  ClientBase.setupTestEnv();
  ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);
  SyncRequestProcessor.setSnapCount(1000);
  final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
  ServerCnxnFactory f = ServerCnxnFactory.createFactory(PORT, -1);
  f.startup(zks);
  try {
    LOG.info("starting up the zookeeper server .. waiting");
    Assert.assertTrue("waiting for server being up",
        ClientBase.waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT));
    ZooKeeper zk = ClientBase.createZKClient(HOSTPORT);
    try {
      zk.addAuthInfo("digest", "pat:test".getBytes());
      zk.setACL("/", Ids.CREATOR_ALL_ACL, -1);
    } finally {
      zk.close();
    }
  } finally {
    f.shutdown();
    zks.shutdown();
    Assert.assertTrue("waiting for server down",
        ClientBase.waitForServerDown(HOSTPORT,
            ClientBase.CONNECTION_TIMEOUT));
  }
}

代码示例来源:origin: apache/zookeeper

QuorumTest.CONNECTION_TIMEOUT));
factory.shutdown();
zks.shutdown();
Assert.assertTrue("waiting for server down",
      ClientBase.waitForServerDown("127.0.0.1:" + PORT,

代码示例来源:origin: apache/zookeeper

zks.shutdown();
f.shutdown();
Assert.assertTrue("waiting for server being down ", ClientBase

代码示例来源:origin: apache/zookeeper

zks.shutdown();
stopServer();

代码示例来源:origin: apache/zookeeper

zks.shutdown();

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com