Java 类org.apache.hadoop.hbase.ClockOutOfSyncException 实例源码

项目:ditb    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  ServerName masterServerName = createRegionServerStatusStub();
  if (masterServerName == null) return null;
  RegionServerStartupResponse result = null;
  try {
    rpcServices.requestCount.set(0);
    LOG.info(
        "reportForDuty to master=" + masterServerName + " with port=" + rpcServices.isa.getPort()
            + ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTime();
    int port = rpcServices.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    if (shouldUseThisHostnameInstead()) {
      request.setUseThisHostnameInstead(useThisHostnameInstead);
    }
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.rssStub.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.fatal("Master rejected startup because clock is out of sync", ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else if (ioe instanceof ServerNotRunningYetException) {
      LOG.debug("Master is not running yet");
    } else {
      LOG.warn("error telling master we are up", se);
    }
    rssStub = null;
  }
  return result;
}
项目:pbase    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
    ServerName masterServerName = createRegionServerStatusStub();
    if (masterServerName == null) return null;
    RegionServerStartupResponse result = null;
    try {
        rpcServices.requestCount.set(0);
        LOG.info("reportForDuty to master=" + masterServerName + " with port="
                + rpcServices.isa.getPort() + ", startcode=" + this.startcode);
        long now = EnvironmentEdgeManager.currentTime();
        int port = rpcServices.isa.getPort();
        RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
        request.setPort(port);
        request.setServerStartCode(this.startcode);
        request.setServerCurrentTime(now);
        result = this.rssStub.regionServerStartup(null, request.build());
    } catch (ServiceException se) {
        IOException ioe = ProtobufUtil.getRemoteException(se);
        if (ioe instanceof ClockOutOfSyncException) {
            LOG.fatal("Master rejected startup because clock is out of sync", ioe);
            // Re-throw IOE will cause RS to abort
            throw ioe;
        } else if (ioe instanceof ServerNotRunningYetException) {
            LOG.debug("Master is not running yet");
        } else {
            LOG.warn("error telling master we are up", se);
        }
    }
    return result;
}
项目:HIndex    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  RegionServerStartupResponse result = null;
  Pair<ServerName, RegionServerStatusService.BlockingInterface> p =
    createRegionServerStatusStub();
  this.rssStub = p.getSecond();
  ServerName masterServerName = p.getFirst();
  if (masterServerName == null) return result;
  try {
    this.requestCount.set(0);
    LOG.info("reportForDuty to master=" + masterServerName + " with port=" + this.isa.getPort() +
      ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTimeMillis();
    int port = this.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.rssStub.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.fatal("Master rejected startup because clock is out of sync", ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else if (ioe instanceof ServerNotRunningYetException) {
      LOG.debug("Master is not running yet");
    } else {
      LOG.warn("error telling master we are up", se);
    }
  }
  return result;
}
项目:hbase    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  if (this.masterless) return RegionServerStartupResponse.getDefaultInstance();
  ServerName masterServerName = createRegionServerStatusStub(true);
  if (masterServerName == null) return null;
  RegionServerStartupResponse result = null;
  try {
    rpcServices.requestCount.reset();
    rpcServices.rpcGetRequestCount.reset();
    rpcServices.rpcScanRequestCount.reset();
    rpcServices.rpcMultiRequestCount.reset();
    rpcServices.rpcMutateRequestCount.reset();
    LOG.info("reportForDuty to master=" + masterServerName + " with port="
      + rpcServices.isa.getPort() + ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTime();
    int port = rpcServices.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    if (!StringUtils.isBlank(useThisHostnameInstead)) {
      request.setUseThisHostnameInstead(useThisHostnameInstead);
    }
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.rssStub.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.error(HBaseMarkers.FATAL, "Master rejected startup because clock is out of sync",
          ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else if (ioe instanceof ServerNotRunningYetException) {
      LOG.debug("Master is not running yet");
    } else {
      LOG.warn("error telling master we are up", se);
    }
    rssStub = null;
  }
  return result;
}
项目:RStore    文件:ServerManager.java   
/**
 * Checks if the clock skew between the server and the master. If the clock
 * skew is too much it will throw an Exception.
 * @param serverName Incoming servers's name
 * @param serverCurrentTime
 * @throws ClockOutOfSyncException
 */
private void checkClockSkew(final ServerName serverName,
    final long serverCurrentTime)
throws ClockOutOfSyncException {
  long skew = System.currentTimeMillis() - serverCurrentTime;
  if (skew > maxSkew) {
    String message = "Server " + serverName + " has been " +
      "rejected; Reported time is too far out of sync with master.  " +
      "Time difference of " + skew + "ms > max allowed of " + maxSkew + "ms";
    LOG.warn(message);
    throw new ClockOutOfSyncException(message);
  }
}
项目:PyroDB    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  RegionServerStartupResponse result = null;
  Pair<ServerName, RegionServerStatusService.BlockingInterface> p =
    createRegionServerStatusStub();
  this.rssStub = p.getSecond();
  ServerName masterServerName = p.getFirst();
  if (masterServerName == null) return result;
  try {
    rpcServices.requestCount.set(0);
    LOG.info("reportForDuty to master=" + masterServerName + " with port="
      + rpcServices.isa.getPort() + ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTimeMillis();
    int port = rpcServices.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.rssStub.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.fatal("Master rejected startup because clock is out of sync", ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else if (ioe instanceof ServerNotRunningYetException) {
      LOG.debug("Master is not running yet");
    } else {
      LOG.warn("error telling master we are up", se);
    }
  }
  return result;
}
项目:c5    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  RegionServerStartupResponse result = null;
  Pair<ServerName, RegionServerStatusService.BlockingInterface> p =
    createRegionServerStatusStub();
  this.rssStub = p.getSecond();
  ServerName masterServerName = p.getFirst();
  if (masterServerName == null) return result;
  try {
    this.requestCount.set(0);
    LOG.info("reportForDuty to master=" + masterServerName + " with port=" + this.isa.getPort() +
      ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTimeMillis();
    int port = this.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.rssStub.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.fatal("Master rejected startup because clock is out of sync", ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else if (ioe instanceof ServerNotRunningYetException) {
      LOG.debug("Master is not running yet");
    } else {
      LOG.warn("error telling master we are up", se);
    }
  }
  return result;
}
项目:DominoHBase    文件:HRegionServer.java   
private RegionServerStartupResponse reportForDuty() throws IOException {
  RegionServerStartupResponse result = null;
  ServerName masterServerName = getMaster();
  if (masterServerName == null) return result;
  try {
    this.requestCount.set(0);
    LOG.info("Telling master at " + masterServerName + " that we are up " +
      "with port=" + this.isa.getPort() + ", startcode=" + this.startcode);
    long now = EnvironmentEdgeManager.currentTimeMillis();
    int port = this.isa.getPort();
    RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder();
    request.setPort(port);
    request.setServerStartCode(this.startcode);
    request.setServerCurrentTime(now);
    result = this.hbaseMaster.regionServerStartup(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof ClockOutOfSyncException) {
      LOG.fatal("Master rejected startup because clock is out of sync", ioe);
      // Re-throw IOE will cause RS to abort
      throw ioe;
    } else {
      LOG.warn("error telling master we are up", se);
    }
  }
  return result;
}