示例#1
0
  /** master和slave之间的同步状态 */
  public void heartBeat() {
    ReplicationRequest command = new ReplicationRequest(true);
    command.setBuckNo(bucket);
    command.setEnvType(EnvType.HEART_BEAT);
    packageRequestHeader(command);

    try {
      Response rsp = (Response) ioSession.syncSendPacket(command, RMI_TIMEOUT);
      if (!rsp.isFailure()) {
        Long maxSeq = (Long) rsp.getContent();
        if (log.isInfoEnabled()) {
          log.info(
              "{}-bucket master-slave max sequence is [{}, {}].", bucket, maxSeq, pos.curMaxSeq());
        }
      } else {
        throw new SyncMasterDataException(rsp.getErrorCode());
      }
    } catch (HippoException e) {
      throw new SyncMasterDataException("Rmi error! " + master + "-" + bucket, e);
    }
  }