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

x33g5p2x  于2022-02-05 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(119)

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

ZKDatabase.getSessionWithTimeOuts介绍

[英]get sessions with timeouts
[中]获取超时会话

代码示例

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

/**
 * serialize the snapshot
 * @param oa the output archive to which the snapshot needs to be serialized
 * @throws IOException
 * @throws InterruptedException
 */
public void serializeSnapshot(OutputArchive oa) throws IOException,
InterruptedException {
  SerializeUtils.serializeSnapshot(getDataTree(), oa, getSessionWithTimeOuts());
}

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

protected void createSessionTracker() {
  sessionTracker = new SessionTrackerImpl(this, zkDb.getSessionWithTimeOuts(),
      tickTime, createSessionTrackerServerId, getZooKeeperServerListener());
}

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

public void takeSnapshot(){
  try {
    txnLogFactory.save(zkDb.getDataTree(), zkDb.getSessionWithTimeOuts());
  } catch (IOException e) {
    LOG.error("Severe unrecoverable error, exiting", e);
    // This is a severe error that we cannot recover from,
    // so we need to exit
    System.exit(10);
  }
}

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

/**
 * serialize the snapshot
 * @param oa the output archive to which the snapshot needs to be serialized
 * @throws IOException
 * @throws InterruptedException
 */
public void serializeSnapshot(OutputArchive oa) throws IOException,
InterruptedException {
  SerializeUtils.serializeSnapshot(getDataTree(), oa, getSessionWithTimeOuts());
}

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

/**
 * deserialize a snapshot from an input archive
 * @param ia the input archive you want to deserialize from
 * @throws IOException
 */
public void deserializeSnapshot(InputArchive ia) throws IOException {
  clear();
  SerializeUtils.deserializeSnapshot(getDataTree(),ia,getSessionWithTimeOuts());
  initialized = true;
}

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

protected void createSessionTracker() {
  sessionTracker = new SessionTrackerImpl(this, zkDb.getSessionWithTimeOuts(),
      tickTime, 1, getZooKeeperServerListener());
}

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

public void takeSnapshot(boolean syncSnap){
  long start = Time.currentElapsedTime();
  try {
    txnLogFactory.save(zkDb.getDataTree(), zkDb.getSessionWithTimeOuts(), syncSnap);
  } catch (IOException e) {
    LOG.error("Severe unrecoverable error, exiting", e);
    // This is a severe error that we cannot recover from,
    // so we need to exit
    System.exit(ExitCode.TXNLOG_ERROR_TAKING_SNAPSHOT.getValue());
  }
  long elapsed = Time.currentElapsedTime() - start;
  LOG.info("Snapshot taken in " + elapsed + " ms");
  ServerMetrics.SNAPSHOT_TIME.add(elapsed);
}

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

/**
 * deserialize a snapshot from an input archive 
 * @param ia the input archive you want to deserialize from
 * @throws IOException
 */
public void deserializeSnapshot(InputArchive ia) throws IOException {
  clear();
  SerializeUtils.deserializeSnapshot(getDataTree(),ia,getSessionWithTimeOuts());
  initialized = true;
}

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

@Override
public void createSessionTracker() {
  sessionTracker = new LearnerSessionTracker(
      this, getZKDatabase().getSessionWithTimeOuts(),
      this.tickTime, self.getId(), self.areLocalSessionsEnabled(),
      getZooKeeperServerListener());
}

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

@Override
public void createSessionTracker() {
  sessionTracker = new LeaderSessionTracker(
      this, getZKDatabase().getSessionWithTimeOuts(),
      tickTime, self.getId(), self.areLocalSessionsEnabled(), 
      getZooKeeperServerListener());
}

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

@Override
public void createSessionTracker() {
  sessionTracker = new SessionTrackerImpl(this, getZKDatabase()
      .getSessionWithTimeOuts(), tickTime, self.getId(),
      getZooKeeperServerListener());
}

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

@Override
public void createSessionTracker() {
  sessionTracker = new LearnerSessionTracker(this, getZKDatabase()
      .getSessionWithTimeOuts(), self.getId(),
      getZooKeeperServerListener());
}

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

if (zkDb.getSessionWithTimeOuts().get(session) == null) {
  deadSessions.add(session);

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

mt[leaderId].main.quorumPeer.getZkDb().getSessionWithTimeOuts();
if (mt[followerA].main.quorumPeer == null) {
  LOG.info("quorumPeer is null");
    mt[followerA].main.quorumPeer.getZkDb().getSessionWithTimeOuts();
LOG.info("sessions are {}, {}", globalSessionsOnLeader.keySet(),
    globalSessionsOnFollowerA.keySet());

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

if (zkDb.getSessionWithTimeOuts().get(session) == null) {
  deadSessions.add(session);

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

mt[i].main.quorumPeer.getZkDb().getSessionWithTimeOuts();
Assert.assertFalse("server " + i + " should not have global " +
    "session " + sessionId, sessions.containsKey(sessionId));

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

snapLog.save(zkDb.getDataTree(), zkDb.getSessionWithTimeOuts(), false);
snapLog.close();

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

start = System.currentTimeMillis();
zkDb2.loadDataBase();
while (zkDb2.getSessionWithTimeOuts().isEmpty() && (System.currentTimeMillis() - start) < 50) {
  Thread.sleep(1);
  zkDb2.loadDataBase();
LOG.info("zkdb2 with timeouts:" + zkDb2.getSessionWithTimeOuts());
Assert.assertNotNull(zkDb2.getSessionWithTimeOuts().get(4L));

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

@Test
public void testTruncationStreamReset() throws Exception {
  File tmpdir = ClientBase.createTmpDir();
  FileTxnSnapLog snaplog = new FileTxnSnapLog(tmpdir, tmpdir);
  ZKDatabase zkdb = new ZKDatabase(snaplog);
  // make sure to snapshot, so that we have something there when
  // truncateLog reloads the db
  snaplog.save(zkdb.getDataTree(), zkdb.getSessionWithTimeOuts(), false);
  for (int i = 1; i <= 100; i++) {
    append(zkdb, i);
  }
  zkdb.truncateLog(1);
  append(zkdb, 200);
  zkdb.close();
  // verify that the truncation and subsequent append were processed
  // correctly
  FileTxnLog txnlog = new FileTxnLog(new File(tmpdir, "version-2"));
  TxnIterator iter = txnlog.read(1);
  TxnHeader hdr = iter.getHeader();
  Record txn = iter.getTxn();
  Assert.assertEquals(1, hdr.getZxid());
  Assert.assertTrue(txn instanceof SetDataTxn);
  iter.next();
  hdr = iter.getHeader();
  txn = iter.getTxn();
  Assert.assertEquals(200, hdr.getZxid());
  Assert.assertTrue(txn instanceof SetDataTxn);
  iter.close();
  ClientBase.recursiveDelete(tmpdir);
}

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

/**
 * serialize the snapshot
 * @param oa the output archive to which the snapshot needs to be serialized
 * @throws IOException
 * @throws InterruptedException
 */
public void serializeSnapshot(OutputArchive oa) throws IOException,
InterruptedException {
  SerializeUtils.serializeSnapshot(getDataTree(), oa, getSessionWithTimeOuts());
}

相关文章