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


Java Server.isStopped方法代码示例

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


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

示例1: openMergedRegion

import org.apache.hadoop.hbase.Server; //导入方法依赖的package包/类
/**
 * Perform time consuming opening of the merged region.
 * @param server Hosting server instance. Can be null when testing
 * @param services Used to online/offline regions.
 * @param merged the merged region
 * @throws IOException If thrown, transaction failed. Call
 *           {@link #rollback(Server, RegionServerServices)}
 */
void openMergedRegion(final Server server,
    final RegionServerServices services, HRegion merged) throws IOException {
  boolean stopped = server != null && server.isStopped();
  boolean stopping = services != null && services.isStopping();
  if (stopped || stopping) {
    LOG.info("Not opening merged region  " + merged.getRegionInfo().getRegionNameAsString()
        + " because stopping=" + stopping + ", stopped=" + stopped);
    return;
  }
  HRegionInfo hri = merged.getRegionInfo();
  LoggingProgressable reporter = server == null ? null
      : new LoggingProgressable(hri, server.getConfiguration().getLong(
          "hbase.regionserver.regionmerge.open.log.interval", 10000));
  merged.openHRegion(reporter);

  if (services != null) {
    try {
      if (useCoordinationForAssignment) {
        services.postOpenDeployTasks(merged);
      } else if (!services.reportRegionStateTransition(TransitionCode.MERGED,
          mergedRegionInfo, region_a.getRegionInfo(), region_b.getRegionInfo())) {
        throw new IOException("Failed to report merged region to master: "
          + mergedRegionInfo.getShortNameToLog());
      }
      services.addToOnlineRegions(merged);
    } catch (KeeperException ke) {
      throw new IOException(ke);
    }
  }

}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:40,代码来源:RegionMergeTransactionImpl.java

示例2: if

import org.apache.hadoop.hbase.Server; //导入方法依赖的package包/类
/**
 * Perform time consuming opening of the daughter regions.
 * @param server Hosting server instance.  Can be null when testing
 * @param services Used to online/offline regions.
 * @param a first daughter region
 * @param a second daughter region
 * @throws IOException If thrown, transaction failed.
 *          Call {@link #rollback(Server, RegionServerServices)}
 */
/* package */void openDaughters(final Server server,
    final RegionServerServices services, Region a, Region b)
    throws IOException {
  boolean stopped = server != null && server.isStopped();
  boolean stopping = services != null && services.isStopping();
  // TODO: Is this check needed here?
  if (stopped || stopping) {
    LOG.info("Not opening daughters " +
        b.getRegionInfo().getRegionNameAsString() +
        " and " +
        a.getRegionInfo().getRegionNameAsString() +
        " because stopping=" + stopping + ", stopped=" + stopped);
  } else {
    // Open daughters in parallel.
    DaughterOpener aOpener = new DaughterOpener(server, (HRegion)a);
    DaughterOpener bOpener = new DaughterOpener(server, (HRegion)b);
    aOpener.start();
    bOpener.start();
    try {
      aOpener.join();
      if (aOpener.getException() == null) {
        transition(SplitTransactionPhase.OPENED_REGION_A);
      }
      bOpener.join();
      if (bOpener.getException() == null) {
        transition(SplitTransactionPhase.OPENED_REGION_B);
      }
    } catch (InterruptedException e) {
      throw (InterruptedIOException)new InterruptedIOException().initCause(e);
    }
    if (aOpener.getException() != null) {
      throw new IOException("Failed " +
        aOpener.getName(), aOpener.getException());
    }
    if (bOpener.getException() != null) {
      throw new IOException("Failed " +
        bOpener.getName(), bOpener.getException());
    }
    if (services != null) {
      try {
        if (useZKForAssignment) {
          // add 2nd daughter first (see HBASE-4335)
          services.postOpenDeployTasks(b);
        } else if (!services.reportRegionStateTransition(TransitionCode.SPLIT,
            parent.getRegionInfo(), hri_a, hri_b)) {
          throw new IOException("Failed to report split region to master: "
            + parent.getRegionInfo().getShortNameToLog());
        }
        // Should add it to OnlineRegions
        services.addToOnlineRegions(b);
        if (useZKForAssignment) {
          services.postOpenDeployTasks(a);
        }
        services.addToOnlineRegions(a);
      } catch (KeeperException ke) {
        throw new IOException(ke);
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:70,代码来源:SplitTransactionImpl.java


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