gpt4 book ai didi

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

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

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

ZooKeeperServer.getTxnLogFactory介绍

暂无

代码示例

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

public void killServer() throws Exception {
    if (zkc != null) {
      zkc.close();
    }

    // shutdown ZK server
    if (serverFactory != null) {
      serverFactory.shutdown();
      Assert.assertTrue(ClientBase.waitForServerDown(getZooKeeperConnectString(), ClientBase.CONNECTION_TIMEOUT),
          "waiting for server down");
    }
    if (zks != null) {
      zks.getTxnLogFactory().close();
    }
    // ServerStats.unregister();
    FileUtils.deleteDirectory(ZkTmpDir);
  }
}

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

File snapFile = factory.zkServer.getTxnLogFactory().findMostRecentSnapshot();
LOG.info("Corrupting " + snapFile);
RandomAccessFile raf = new RandomAccessFile(snapFile, "rws");

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

@Test
public void testTxnLogElapsedSyncTime() throws IOException {
  File tmpDir = ClientBase.createEmptyTestDir();
  FileTxnSnapLog fileTxnSnapLog = new FileTxnSnapLog(new File(tmpDir, "data"),
      new File(tmpDir, "data_txnlog"));
  ZooKeeperServer zks = new ZooKeeperServer();
  zks.setTxnLogFactory(fileTxnSnapLog);
  ZooKeeperServerBean serverBean = new ZooKeeperServerBean(zks);
  long elapsedTime = serverBean.getTxnLogElapsedSyncTime();
  assertEquals(-1, elapsedTime);
  TxnHeader hdr = new TxnHeader(1, 1, 1, 1, ZooDefs.OpCode.setData);
  Record txn = new SetDataTxn("/foo", new byte[0], 1);
  Request req = new Request(0, 0, 0, hdr, txn, 0);
  try {
    zks.getTxnLogFactory().append(req);
    zks.getTxnLogFactory().commit();
    elapsedTime = serverBean.getTxnLogElapsedSyncTime();
    assertNotEquals(-1, elapsedTime);
    assertEquals(elapsedTime, serverBean.getTxnLogElapsedSyncTime());
  } finally {
    fileTxnSnapLog.close();
  }
}

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

f.shutdown();
zks.shutdown();
zks.getTxnLogFactory().close();

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

FileTxnSnapLog snapLog = zooKeeperServer.getTxnLogFactory();
FileTxnSnapLog fileTxnSnapLogWithError = new FileTxnSnapLog(
    snapLog.getDataDir(), snapLog.getSnapDir()) {

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

FileTxnSnapLog txnLogFactory = zks.getTxnLogFactory();
List<File> snapshots = txnLogFactory.findNRecentSnapshots(10);
Assert.assertTrue("We have a snapshot to corrupt", snapshots.size() > 0);

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

zks.getTxnLogFactory().close();
Assert.assertTrue("waiting for server to shutdown",
    ClientBase.waitForServerDown(HOSTPORT, CONNECTION_TIMEOUT));

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

zks.getTxnLogFactory().close();
zks.shutdown();
Assert.assertTrue("waiting for server to shutdown",
zks.getTxnLogFactory().close();
zks.shutdown();

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

FileTxnSnapLog snapLog = leader.getActiveServer().getTxnLogFactory();
FileTxnSnapLog fileTxnSnapLogWithError = new FileTxnSnapLog(
    snapLog.getDataDir(), snapLog.getSnapDir()) {

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