当前位置: 首页>>代码示例>>Java>>正文


Java ZxidUtils.getEpochFromZxid方法代码示例

本文整理汇总了Java中org.apache.zookeeper.server.util.ZxidUtils.getEpochFromZxid方法的典型用法代码示例。如果您正苦于以下问题:Java ZxidUtils.getEpochFromZxid方法的具体用法?Java ZxidUtils.getEpochFromZxid怎么用?Java ZxidUtils.getEpochFromZxid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.server.util.ZxidUtils的用法示例。


在下文中一共展示了ZxidUtils.getEpochFromZxid方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = System.currentTimeMillis();
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - " +
          (self.end_fle - self.start_fle));
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        InetSocketAddress addr = findLeader();            
        try {
            connectToLeader(addr);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);

            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (this.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (Exception e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:48,代码来源:Follower.java

示例2: registerWithLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
   * Once connected to the leader, perform the handshake protocol to
   * establish a following / observing connection. 
   * @param pktType
   * @return the zxid the Leader sends for synchronization purposes.
   * @throws IOException
   */
  protected long registerWithLeader(int pktType) throws IOException{
      /*
       * Send follower info, including last zxid and sid
       */
  	long lastLoggedZxid = self.getLastLoggedZxid();
      QuorumPacket qp = new QuorumPacket();                
      qp.setType(pktType);
      qp.setZxid(ZxidUtils.makeZxid(self.getAcceptedEpoch(), 0));
      
      /*
       * Add sid to payload
       */
      LearnerInfo li = new LearnerInfo(self.getId(), 0x10000);
      ByteArrayOutputStream bsid = new ByteArrayOutputStream();
      BinaryOutputArchive boa = BinaryOutputArchive.getArchive(bsid);
      boa.writeRecord(li, "LearnerInfo");
      qp.setData(bsid.toByteArray());
      
      writePacket(qp, true);
      readPacket(qp);        
      final long newEpoch = ZxidUtils.getEpochFromZxid(qp.getZxid());
if (qp.getType() == Leader.LEADERINFO) {
      	// we are connected to a 1.0 server so accept the new epoch and read the next packet
      	leaderProtocolVersion = ByteBuffer.wrap(qp.getData()).getInt();
      	byte epochBytes[] = new byte[4];
      	final ByteBuffer wrappedEpochBytes = ByteBuffer.wrap(epochBytes);
      	if (newEpoch > self.getAcceptedEpoch()) {
      		wrappedEpochBytes.putInt((int)self.getCurrentEpoch());
      		self.setAcceptedEpoch(newEpoch);
      	} else if (newEpoch == self.getAcceptedEpoch()) {
      		// since we have already acked an epoch equal to the leaders, we cannot ack
      		// again, but we still need to send our lastZxid to the leader so that we can
      		// sync with it if it does assume leadership of the epoch.
      		// the -1 indicates that this reply should not count as an ack for the new epoch
              wrappedEpochBytes.putInt(-1);
      	} else {
      		throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch());
      	}
      	QuorumPacket ackNewEpoch = new QuorumPacket(Leader.ACKEPOCH, lastLoggedZxid, epochBytes, null);
      	writePacket(ackNewEpoch, true);
          return ZxidUtils.makeZxid(newEpoch, 0);
      } else {
      	if (newEpoch > self.getAcceptedEpoch()) {
      		self.setAcceptedEpoch(newEpoch);
      	}
          if (qp.getType() != Leader.NEWLEADER) {
              LOG.error("First packet should have been NEWLEADER");
              throw new IOException("First packet should have been NEWLEADER");
          }
          return qp.getZxid();
      }
  }
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:60,代码来源:Learner.java

示例3: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = Time.currentElapsedTime();
    long electionTimeTaken = self.end_fle - self.start_fle;
    self.setElectionTimeTaken(electionTimeTaken);
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - {} {}", electionTimeTaken,
            QuorumPeer.FLE_TIME_UNIT);
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        InetSocketAddress addr = findLeader();            
        try {
            connectToLeader(addr);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);
            if (self.isReconfigStateChange())
               throw new Exception("learned about role change");
            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (this.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (Exception e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:51,代码来源:Follower.java

示例4: registerWithLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
   * Once connected to the leader, perform the handshake protocol to
   * establish a following / observing connection. 
   * @param pktType
   * @return the zxid the Leader sends for synchronization purposes.
   * @throws IOException
   */
  protected long registerWithLeader(int pktType) throws IOException{
      /*
       * Send follower info, including last zxid and sid
       */
  	long lastLoggedZxid = self.getLastLoggedZxid();
      QuorumPacket qp = new QuorumPacket();                
      qp.setType(pktType);
      qp.setZxid(ZxidUtils.makeZxid(self.getAcceptedEpoch(), 0));
      
      /*
       * Add sid to payload
       */
      LearnerInfo li = new LearnerInfo(self.getId(), 0x10000, self.getQuorumVerifier().getVersion());
      ByteArrayOutputStream bsid = new ByteArrayOutputStream();
      BinaryOutputArchive boa = BinaryOutputArchive.getArchive(bsid);
      boa.writeRecord(li, "LearnerInfo");
      qp.setData(bsid.toByteArray());
      
      writePacket(qp, true);
      readPacket(qp);        
      final long newEpoch = ZxidUtils.getEpochFromZxid(qp.getZxid());
if (qp.getType() == Leader.LEADERINFO) {
      	// we are connected to a 1.0 server so accept the new epoch and read the next packet
      	leaderProtocolVersion = ByteBuffer.wrap(qp.getData()).getInt();
      	byte epochBytes[] = new byte[4];
      	final ByteBuffer wrappedEpochBytes = ByteBuffer.wrap(epochBytes);
      	if (newEpoch > self.getAcceptedEpoch()) {
      		wrappedEpochBytes.putInt((int)self.getCurrentEpoch());
      		self.setAcceptedEpoch(newEpoch);
      	} else if (newEpoch == self.getAcceptedEpoch()) {
      		// since we have already acked an epoch equal to the leaders, we cannot ack
      		// again, but we still need to send our lastZxid to the leader so that we can
      		// sync with it if it does assume leadership of the epoch.
      		// the -1 indicates that this reply should not count as an ack for the new epoch
              wrappedEpochBytes.putInt(-1);
      	} else {
      		throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch());
      	}
      	QuorumPacket ackNewEpoch = new QuorumPacket(Leader.ACKEPOCH, lastLoggedZxid, epochBytes, null);
      	writePacket(ackNewEpoch, true);
          return ZxidUtils.makeZxid(newEpoch, 0);
      } else {
      	if (newEpoch > self.getAcceptedEpoch()) {
      		self.setAcceptedEpoch(newEpoch);
      	}
          if (qp.getType() != Leader.NEWLEADER) {
              LOG.error("First packet should have been NEWLEADER");
              throw new IOException("First packet should have been NEWLEADER");
          }
          return qp.getZxid();
      }
  }
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:60,代码来源:Learner.java

示例5: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = System.currentTimeMillis();
    long electionTimeTaken = self.end_fle - self.start_fle;
    self.setElectionTimeTaken(electionTimeTaken);
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - {}", electionTimeTaken);
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        QuorumServer leaderServer = findLeader();            
        try {
            connectToLeader(leaderServer.addr, leaderServer.hostname);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);

            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (this.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (Exception e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:49,代码来源:Follower.java

示例6: testUpdatingEpoch

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * ZOOKEEPER-1653 Make sure the server starts if the current epoch is less
 * than the epoch from last logged zxid and updatingEpoch file exists.
 */
@Test
public void testUpdatingEpoch() throws Exception {
    // Create a cluster and restart them multiple times to bump the epoch.
    numServers = 3;
    servers = LaunchServers(numServers);
    File currentEpochFile;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < numServers; j++) {
            servers.mt[j].shutdown();
        }
        waitForAll(servers.zk, States.CONNECTING);
        for (int j = 0; j < numServers; j++) {
            servers.mt[j].start();
        }
        waitForAll(servers.zk, States.CONNECTED);
    }

    // Current epoch is 11 now.
    for (int i = 0; i < numServers; i++) {
        currentEpochFile = new File(
            new File(servers.mt[i].dataDir, "version-2"),
            QuorumPeer.CURRENT_EPOCH_FILENAME);
        LOG.info("Validating current epoch: " + servers.mt[i].dataDir);
        Assert.assertEquals("Current epoch should be 11.", 11,
                            readLongFromFile(currentEpochFile));
    }

    // Find a follower and get epoch from the last logged zxid.
    int followerIndex = -1;
    for (int i = 0; i < numServers; i++) {
        if (servers.mt[i].main.quorumPeer.leader == null) {
            followerIndex = i;
            break;
        }
    }
    Assert.assertTrue("Found a valid follower",
                      followerIndex >= 0 && followerIndex < numServers);
    MainThread follower = servers.mt[followerIndex];
    long zxid = follower.main.quorumPeer.getLastLoggedZxid();
    long epochFromZxid = ZxidUtils.getEpochFromZxid(zxid);

    // Shutdown the cluster
    for (int i = 0; i < numServers; i++) {
      servers.mt[i].shutdown();
    }
    waitForAll(servers.zk, States.CONNECTING);

    // Make current epoch less than epoch from the last logged zxid.
    // The server should fail to start.
    File followerDataDir = new File(follower.dataDir, "version-2");
    currentEpochFile = new File(followerDataDir,
            QuorumPeer.CURRENT_EPOCH_FILENAME);
    writeLongToFile(currentEpochFile, epochFromZxid - 1);
    follower.start();
    Assert.assertTrue(follower.mainFailed.await(10, TimeUnit.SECONDS));

    // Touch the updateEpoch file. Now the server should start.
    File updatingEpochFile = new File(followerDataDir,
            QuorumPeer.UPDATING_EPOCH_FILENAME);
    updatingEpochFile.createNewFile();
    for (int i = 0; i < numServers; i++) {
      servers.mt[i].start();
    }
    waitForAll(servers.zk, States.CONNECTED);
    Assert.assertNotNull("Make sure the server started with acceptEpoch",
                         follower.main.quorumPeer.getActiveServer());
    Assert.assertFalse("updatingEpoch file should get deleted",
                       updatingEpochFile.exists());
}
 
开发者ID:jdc91,项目名称:StreamProcessingInfrastructure,代码行数:74,代码来源:QuorumPeerMainTest.java

示例7: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = System.currentTimeMillis();
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - " +
          (self.end_fle - self.start_fle));
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        InetSocketAddress addr = findLeader();            
        try {
            connectToLeader(addr);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);

            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (self.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (IOException e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:48,代码来源:Follower.java

示例8: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = Time.currentElapsedTime();
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - " +
          (self.end_fle - self.start_fle));
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        InetSocketAddress addr = findLeader();            
        try {
            connectToLeader(addr);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);
            if (self.isReconfigStateChange())
               throw new Exception("learned about role change");
            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (self.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (Exception e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:49,代码来源:Follower.java

示例9: registerWithLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
   * Once connected to the leader, perform the handshake protocol to
   * establish a following / observing connection. 
   * @param pktType
   * @return the zxid the Leader sends for synchronization purposes.
   * @throws IOException
   */
  protected long registerWithLeader(int pktType) throws IOException{
      /*
       * Send follower info, including last zxid and sid
       */
  	long lastLoggedZxid = self.getLastLoggedZxid();
      QuorumPacket qp = new QuorumPacket();                
      qp.setType(pktType);
      qp.setZxid(ZxidUtils.makeZxid(self.getAcceptedEpoch(), 0));
      
      /*
       * Add sid to payload
       */
      LearnerInfo li = new LearnerInfo(self.getId(), 0x10000);
      ByteArrayOutputStream bsid = new ByteArrayOutputStream();
      BinaryOutputArchive boa = BinaryOutputArchive.getArchive(bsid);
      boa.writeRecord(li, "LearnerInfo");
      qp.setData(bsid.toByteArray());
      
      writePacket(qp, true);
      readPacket(qp);        
      final long newEpoch = ZxidUtils.getEpochFromZxid(qp.getZxid());
if (qp.getType() == Leader.LEADERINFO) {
      	// we are connected to a 1.0 server so accept the new epoch and read the next packet
      	leaderProtocolVersion = ByteBuffer.wrap(qp.getData()).getInt();
      	byte epochBytes[] = new byte[4];
      	final ByteBuffer wrappedEpochBytes = ByteBuffer.wrap(epochBytes);
      	if (newEpoch > self.getAcceptedEpoch()) {
      		wrappedEpochBytes.putInt((int)self.getCurrentEpoch());
      		self.setAcceptedEpoch(newEpoch);
      	} else if (newEpoch == self.getAcceptedEpoch()) {
      		// since we have already acked an epoch equal to the leaders, we cannot ack
      		// again, but we still need to send our lastZxid to the leader so that we can
      		// sync with it if it does assume leadership of the epoch.
      		// the -1 indicates that this reply should not count as an ack for the new epoch
              wrappedEpochBytes.putInt(-1);
      	} else {
      		throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch());
      	}
      	QuorumPacket ackNewEpoch = new QuorumPacket(Leader.ACKEPOCH, lastLoggedZxid, epochBytes, null);
      	writePacket(ackNewEpoch, true);
      	readPacket(qp);
      } else {
      	if (newEpoch > self.getAcceptedEpoch()) {
      		self.setAcceptedEpoch(newEpoch);
      	}
      }
      if (qp.getType() != Leader.NEWLEADER) {
          LOG.error("First packet should have been NEWLEADER");
          throw new IOException("First packet should have been NEWLEADER");
      }
      
      return qp.getZxid();
  }
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:61,代码来源:Learner.java

示例10: followLeader

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * the main method called by the follower to follow the leader
 *
 * @throws InterruptedException
 */
void followLeader() throws InterruptedException {
    self.end_fle = System.currentTimeMillis();
    LOG.info("FOLLOWING - LEADER ELECTION TOOK - " +
          (self.end_fle - self.start_fle));
    self.start_fle = 0;
    self.end_fle = 0;
    fzk.registerJMX(new FollowerBean(this, zk), self.jmxLocalPeerBean);
    try {
        InetSocketAddress addr = findLeader();            
        try {
            connectToLeader(addr);
            long newEpochZxid = registerWithLeader(Leader.FOLLOWERINFO);

            //check to see if the leader zxid is lower than ours
            //this should never happen but is just a safety check
            long newEpoch = ZxidUtils.getEpochFromZxid(newEpochZxid);
            if (newEpoch < self.getAcceptedEpoch()) {
                LOG.error("Proposed leader epoch " + ZxidUtils.zxidToString(newEpochZxid)
                        + " is less than our accepted epoch " + ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                throw new IOException("Error: Epoch of leader is lower");
            }
            syncWithLeader(newEpochZxid);                
            QuorumPacket qp = new QuorumPacket();
            while (self.isRunning()) {
                readPacket(qp);
                processPacket(qp);
            }
        } catch (Exception e) {
            LOG.warn("Exception when following the leader", e);
            try {
                sock.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            // clear pending revalidations
            pendingRevalidations.clear();
        }
    } finally {
        zk.unregisterJMX((Learner)this);
    }
}
 
开发者ID:txazo,项目名称:zookeeper,代码行数:48,代码来源:Follower.java

示例11: getEpoch

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * Returns the current epoch of the leader.
 * 
 * @return
 */
public long getEpoch(){
    return ZxidUtils.getEpochFromZxid(lastProposed);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:Leader.java

示例12: getEpoch

import org.apache.zookeeper.server.util.ZxidUtils; //导入方法依赖的package包/类
/**
 * Returns the current epoch of the leader.
 *
 * @return
 */
public long getEpoch(){
    return ZxidUtils.getEpochFromZxid(lastProposed);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:Leader.java


注:本文中的org.apache.zookeeper.server.util.ZxidUtils.getEpochFromZxid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。