當前位置: 首頁>>代碼示例>>Java>>正文


Java ServerName.parseVersionedServerName方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.ServerName.parseVersionedServerName方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerName.parseVersionedServerName方法的具體用法?Java ServerName.parseVersionedServerName怎麽用?Java ServerName.parseVersionedServerName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.ServerName的用法示例。


在下文中一共展示了ServerName.parseVersionedServerName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tryRegionServerReport

import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
@VisibleForTesting protected void tryRegionServerReport(long reportStartTime, long reportEndTime)
    throws IOException {
  RegionServerStatusService.BlockingInterface rss = rssStub;
  if (rss == null) {
    // the current server could be stopping.
    return;
  }
  ClusterStatusProtos.ServerLoad sl = buildServerLoad(reportStartTime, reportEndTime);
  try {
    RegionServerReportRequest.Builder request = RegionServerReportRequest.newBuilder();
    ServerName sn = ServerName.parseVersionedServerName(this.serverName.getVersionedBytes());
    request.setServer(ProtobufUtil.toServerName(sn));
    request.setLoad(sl);
    rss.regionServerReport(null, request.build());
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof YouAreDeadException) {
      // This will be caught and handled as a fatal error in run()
      throw ioe;
    }
    if (rssStub == rss) {
      rssStub = null;
    }
    // Couldn't connect to the master, get location from zk and reconnect
    // Method blocks until new master is found or we are stopped
    createRegionServerStatusStub();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:HRegionServer.java

示例2: abort

import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
/**
 * Cause the server to exit without closing the regions it is serving, the log
 * it is using and without notifying the master. Used unit testing and on
 * catastrophic events such as HDFS is yanked out from under hbase or we OOME.
 *
 * @param reason the reason we are aborting
 * @param cause  the exception that caused the abort, or null
 */
@Override public void abort(String reason, Throwable cause) {
  String msg = "ABORTING region server " + this + ": " + reason;
  if (cause != null) {
    LOG.fatal(msg, cause);
  } else {
    LOG.fatal(msg);
  }
  this.abortRequested = true;
  // HBASE-4014: show list of coprocessors that were loaded to help debug
  // regionserver crashes.Note that we're implicitly using
  // java.util.HashSet's toString() method to print the coprocessor names.
  LOG.fatal(
      "RegionServer abort: loaded coprocessors are: " + CoprocessorHost.getLoadedCoprocessors());
  // Try and dump metrics if abort -- might give clue as to how fatal came about....
  try {
    LOG.info("Dump of metrics as JSON on abort: " + JSONBean.dumpRegionServerMetrics());
  } catch (MalformedObjectNameException | IOException e) {
    LOG.warn("Failed dumping metrics", e);
  }

  // Do our best to report our abort to the master, but this may not work
  try {
    if (cause != null) {
      msg += "\nCause:\n" + StringUtils.stringifyException(cause);
    }
    // Report to the master but only if we have already registered with the master.
    if (rssStub != null && this.serverName != null) {
      ReportRSFatalErrorRequest.Builder builder = ReportRSFatalErrorRequest.newBuilder();
      ServerName sn = ServerName.parseVersionedServerName(this.serverName.getVersionedBytes());
      builder.setServer(ProtobufUtil.toServerName(sn));
      builder.setErrorMessage(msg);
      rssStub.reportRSFatalError(null, builder.build());
    }
  } catch (Throwable t) {
    LOG.warn("Unable to report fatal error to master", t);
  }
  stop(reason);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:47,代碼來源:HRegionServer.java


注:本文中的org.apache.hadoop.hbase.ServerName.parseVersionedServerName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。