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


Java DoNotRetryIOException.getCause方法代码示例

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


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

示例1: reportRegionSizesForQuotas

import org.apache.hadoop.hbase.DoNotRetryIOException; //导入方法依赖的package包/类
/**
 * Reports the given map of Regions and their size on the filesystem to the active Master.
 *
 * @param onlineRegionSizes A map of region info to size in bytes
 * @return false if FileSystemUtilizationChore should pause reporting to master. true otherwise
 */
public boolean reportRegionSizesForQuotas(final Map<RegionInfo, Long> onlineRegionSizes) {
  RegionServerStatusService.BlockingInterface rss = rssStub;
  if (rss == null) {
    // the current server could be stopping.
    LOG.trace("Skipping Region size report to HMaster as stub is null");
    return true;
  }
  try {
    RegionSpaceUseReportRequest request = buildRegionSpaceUseReportRequest(
        Objects.requireNonNull(onlineRegionSizes));
    rss.reportRegionSpaceUse(null, request);
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof PleaseHoldException) {
      LOG.trace("Failed to report region sizes to Master because it is initializing."
          + " This will be retried.", ioe);
      // The Master is coming up. Will retry the report later. Avoid re-creating the stub.
      return true;
    }
    if (rssStub == rss) {
      rssStub = null;
    }
    createRegionServerStatusStub(true);
    if (ioe instanceof DoNotRetryIOException) {
      DoNotRetryIOException doNotRetryEx = (DoNotRetryIOException) ioe;
      if (doNotRetryEx.getCause() != null) {
        Throwable t = doNotRetryEx.getCause();
        if (t instanceof UnsupportedOperationException) {
          LOG.debug("master doesn't support ReportRegionSpaceUse, pause before retrying");
          return false;
        }
      }
    }
    LOG.debug("Failed to report region sizes to Master. This will be retried.", ioe);
  }
  return true;
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:HRegionServer.java

示例2: handleScanError

import org.apache.hadoop.hbase.DoNotRetryIOException; //导入方法依赖的package包/类
private void handleScanError(DoNotRetryIOException e,
    MutableBoolean retryAfterOutOfOrderException, int retriesLeft) throws DoNotRetryIOException {
  // An exception was thrown which makes any partial results that we were collecting
  // invalid. The scanner will need to be reset to the beginning of a row.
  scanResultCache.clear();

  // Unfortunately, DNRIOE is used in two different semantics.
  // (1) The first is to close the client scanner and bubble up the exception all the way
  // to the application. This is preferred when the exception is really un-recoverable
  // (like CorruptHFileException, etc). Plain DoNotRetryIOException also falls into this
  // bucket usually.
  // (2) Second semantics is to close the current region scanner only, but continue the
  // client scanner by overriding the exception. This is usually UnknownScannerException,
  // OutOfOrderScannerNextException, etc where the region scanner has to be closed, but the
  // application-level ClientScanner has to continue without bubbling up the exception to
  // the client. See RSRpcServices to see how it throws DNRIOE's.
  // See also: HBASE-16604, HBASE-17187

  // If exception is any but the list below throw it back to the client; else setup
  // the scanner and retry.
  Throwable cause = e.getCause();
  if ((cause != null && cause instanceof NotServingRegionException) ||
      (cause != null && cause instanceof RegionServerStoppedException) ||
      e instanceof OutOfOrderScannerNextException || e instanceof UnknownScannerException ||
      e instanceof ScannerResetException) {
    // Pass. It is easier writing the if loop test as list of what is allowed rather than
    // as a list of what is not allowed... so if in here, it means we do not throw.
    if (retriesLeft <= 0) {
      throw e; // no more retries
    }
  } else {
    throw e;
  }

  // Else, its signal from depths of ScannerCallable that we need to reset the scanner.
  if (this.lastResult != null) {
    // The region has moved. We need to open a brand new scanner at the new location.
    // Reset the startRow to the row we've seen last so that the new scanner starts at
    // the correct row. Otherwise we may see previously returned rows again.
    // If the lastRow is not partial, then we should start from the next row. As now we can
    // exclude the start row, the logic here is the same for both normal scan and reversed scan.
    // If lastResult is partial then include it, otherwise exclude it.
    scan.withStartRow(lastResult.getRow(), lastResult.mayHaveMoreCellsInRow());
  }
  if (e instanceof OutOfOrderScannerNextException) {
    if (retryAfterOutOfOrderException.isTrue()) {
      retryAfterOutOfOrderException.setValue(false);
    } else {
      // TODO: Why wrap this in a DNRIOE when it already is a DNRIOE?
      throw new DoNotRetryIOException(
          "Failed after retry of OutOfOrderScannerNextException: was there a rpc timeout?", e);
    }
  }
  // Clear region.
  this.currentRegion = null;
  // Set this to zero so we don't try and do an rpc and close on remote server when
  // the exception we got was UnknownScanner or the Server is going down.
  callable = null;
}
 
开发者ID:apache,项目名称:hbase,代码行数:60,代码来源:ClientScanner.java


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