• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java State类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



State类属于org.apache.hadoop.hbase.master.AssignmentManager.RegionState包,在下文中一共展示了State类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processResult

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
@Override
public void processResult(int rc, String path, Object ctx, Stat stat) {
  if (rc != 0) {
    // This is resultcode.  If non-zero, need to resubmit.
    LOG.warn("rc != 0 for " + path + " -- some error, may be connection loss -- " +
      "FIX see http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A2");
    parent.reportCompletion(false);
    return;
  }
  RegionState state = (RegionState)ctx;
  LOG.debug("rs=" + state);
  // Transition RegionState to PENDING_OPEN here in master; means we've
  // sent the open.  We're a little ahead of ourselves here since we've not
  // yet sent out the actual open but putting this state change after the
  // call to open risks our writing PENDING_OPEN after state has been moved
  // to OPENING by the regionserver.
  state.update(RegionState.State.PENDING_OPEN, System.currentTimeMillis(), destination);
  parent.reportCompletion(true);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:20,代码来源:AssignmentManager.java


示例2: forceRegionStateToOffline

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
/**
 * Sets regions {@link RegionState} to {@link RegionState.State#OFFLINE}.
 * Caller must hold lock on this.regionsInTransition.
 * @param region
 * @param hijack
 * @return Amended RegionState.
 */
private RegionState forceRegionStateToOffline(final HRegionInfo region,
    boolean hijack) {
  String encodedName = region.getEncodedName();
  RegionState state = this.regionsInTransition.get(encodedName);
  if (state == null) {
    state = new RegionState(region, RegionState.State.OFFLINE);
    this.regionsInTransition.put(encodedName, state);
  } else {
    // If we are reassigning the node do not force in-memory state to OFFLINE.
    // Based on the znode state we will decide if to change in-memory state to
    // OFFLINE or not. It will be done before setting znode to OFFLINE state.

    // We often get here with state == CLOSED because ClosedRegionHandler will
    // assign on its tail as part of the handling of a region close.
    if (!hijack) {
      LOG.debug("Forcing OFFLINE; was=" + state);
      state.update(RegionState.State.OFFLINE);
    }
  }
  return state;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:AssignmentManager.java


示例3: asyncSetOfflineInZooKeeper

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
/**
 * Set region as OFFLINED up in zookeeper asynchronously.
 * @param state
 * @return True if we succeeded, false otherwise (State was incorrect or failed
 * updating zk).
 */
boolean asyncSetOfflineInZooKeeper(final RegionState state,
    final AsyncCallback.StringCallback cb, final Object ctx) {
  if (!state.isClosed() && !state.isOffline()) {
      new RuntimeException("Unexpected state trying to OFFLINE; " + state);
    this.master.abort("Unexpected state trying to OFFLINE; " + state,
      new IllegalStateException());
    return false;
  }
  state.update(RegionState.State.OFFLINE);
  try {
    ZKAssign.asyncCreateNodeOffline(master.getZooKeeper(), state.getRegion(),
      this.master.getServerName(), cb, ctx);
  } catch (KeeperException e) {
    // TODO: this error handling will never execute, as the callback is async.
    if (e instanceof NodeExistsException) {
      LOG.warn("Node for " + state.getRegion() + " already exists");
    } else { 
      master.abort("Unexpected ZK exception creating/setting node OFFLINE", e);
    }
    return false;
  }
  return true;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:30,代码来源:AssignmentManager.java


示例4: forceOffline

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
/**
 * Put the region <code>hri</code> into an offline state up in zk.
 * @param hri
 * @param oldData
 * @throws KeeperException
 */
private void forceOffline(final HRegionInfo hri,
    final RegionTransitionData oldData)
throws KeeperException {
  // If was on dead server, its closed now.  Force to OFFLINE and then
  // handle it like a close; this will get it reassigned if appropriate
  LOG.debug("RIT " + hri.getEncodedName() + " in state=" +
    oldData.getEventType() + " was on deadserver; forcing offline");
  ZKAssign.createOrForceNodeOffline(this.watcher, hri,
    this.master.getServerName());
  addToRITandCallClose(hri, RegionState.State.OFFLINE, oldData);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:AssignmentManager.java


示例5: convertPendingCloseToSplitting

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
/**
 * If the passed regionState is in PENDING_CLOSE, clean up PENDING_CLOSE
 * state and convert it to SPLITTING instead.
 * This can happen in case where master wants to close a region at same time
 * a regionserver starts a split.  The split won.  Clean out old PENDING_CLOSE
 * state.
 * @param rs
 * @return True if we converted from PENDING_CLOSE to SPLITTING
 */
private boolean convertPendingCloseToSplitting(final RegionState rs) {
  if (!rs.isPendingClose()) return false;
  LOG.debug("Converting PENDING_CLOSE to SPLITING; rs=" + rs);
  rs.update(RegionState.State.SPLITTING);
  // Clean up existing state.  Clear from region plans seems all we
  // have to do here by way of clean up of PENDING_CLOSE.
  clearRegionPlan(rs.getRegion());
  return true;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:AssignmentManager.java


示例6: addSplittingToRIT

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
/**
 * @param serverName
 * @param encodedName
 * @return The SPLITTING RegionState we added to RIT for the passed region
 * <code>encodedName</code>
 */
private RegionState addSplittingToRIT(final ServerName serverName,
    final String encodedName) {
  RegionState regionState = null;
  synchronized (this.regions) {
    regionState = findHRegionInfoThenAddToRIT(serverName, encodedName);
    if (regionState != null) {
      regionState.update(RegionState.State.SPLITTING,
        System.currentTimeMillis(), serverName);
    }
  }
  return regionState;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:AssignmentManager.java


示例7: readFields

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
  region = new HRegionInfo();
  region.readFields(in);
  state = State.valueOf(in.readUTF());
  stamp.set(in.readLong());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:8,代码来源:AssignmentManager.java


示例8: testSSHWhenSourceRSandDestRSInRegionPlanGoneDown

import org.apache.hadoop.hbase.master.AssignmentManager.RegionState.State; //导入依赖的package包/类
private void testSSHWhenSourceRSandDestRSInRegionPlanGoneDown(boolean regionInOffline)
    throws IOException, KeeperException, ServiceException {
  // We need a mocked catalog tracker.
  CatalogTracker ct = Mockito.mock(CatalogTracker.class);
  // Create an AM.
  AssignmentManagerWithExtrasForTesting am =
      setUpMockedAssignmentManager(this.server, this.serverManager);
  // adding region in pending open.
  if (regionInOffline) {
    ServerName MASTER_SERVERNAME = new ServerName("example.org", 1111, 1111);
    am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
        State.OFFLINE, System.currentTimeMillis(), MASTER_SERVERNAME));
  } else {
    am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
        State.OPENING, System.currentTimeMillis(), SERVERNAME_B));
  }
  // adding region plan
  am.regionPlans.put(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, SERVERNAME_A, SERVERNAME_B));
  am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());

  try {
    processServerShutdownHandler(ct, am, false, SERVERNAME_A);
    processServerShutdownHandler(ct, am, false, SERVERNAME_B);
    if(regionInOffline){
      assertFalse("Assign should not be invoked.", am.assignInvoked);
    } else {
      assertTrue("Assign should be invoked.", am.assignInvoked);
    }
  } finally {
    am.regionsInTransition.remove(REGIONINFO.getEncodedName());
    am.regionPlans.remove(REGIONINFO.getEncodedName());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:34,代码来源:TestAssignmentManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BasePagingLoader类代码示例发布时间:2022-05-22
下一篇:
Java TransactionSynchronizationUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap