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

Java EventType类代码示例

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

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



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

示例1: OpenedRegionHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public OpenedRegionHandler(Server server,
    AssignmentManager assignmentManager, HRegionInfo regionInfo,
    OpenRegionCoordination coordination,
    OpenRegionCoordination.OpenRegionDetails ord) {
  super(server, EventType.RS_ZK_REGION_OPENED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  this.coordination = coordination;
  this.ord = ord;
  if(regionInfo.isMetaRegion()) {
    priority = OpenedPriority.META;
  } else if(regionInfo.getTable()
      .getNamespaceAsString().equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
    priority = OpenedPriority.SYSTEM;
  } else {
    priority = OpenedPriority.USER;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:OpenedRegionHandler.java


示例2: RestoreSnapshotHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public RestoreSnapshotHandler(final MasterServices masterServices,
    final SnapshotDescription snapshot, final HTableDescriptor htd) throws IOException {
  super(EventType.C_M_RESTORE_SNAPSHOT, htd.getTableName(), masterServices, masterServices);

  // Snapshot information
  this.snapshot = snapshot;

  // Monitor
  this.monitor = new ForeignExceptionDispatcher();

  // Check table exists.
  getTableDescriptor();

  // This is the new schema we are going to write out as this modification.
  this.hTableDescriptor = htd;

  this.status = TaskMonitor.get().createStatus(
    "Restoring  snapshot '" + snapshot.getName() + "' to table "
        + hTableDescriptor.getTableName());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:RestoreSnapshotHandler.java


示例3: deleteNodeInStates

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
private boolean deleteNodeInStates(String encodedName,
    String desc, ServerName sn, EventType... types) {
  try {
    for (EventType et: types) {
      if (ZKAssign.deleteNode(watcher, encodedName, et, sn)) {
        return true;
      }
    }
    LOG.info("Failed to delete the " + desc + " node for "
      + encodedName + ". The node type may not match");
  } catch (NoNodeException e) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("The " + desc + " node for " + encodedName + " already deleted");
    }
  } catch (KeeperException ke) {
    server.abort("Unexpected ZK exception deleting " + desc
      + " node for the region " + encodedName, ke);
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:AssignmentManager.java


示例4: verifyRegionState

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * Verifies that the specified region is in the specified state in ZooKeeper.
 * <p>
 * Returns true if region is in transition and in the specified state in
 * ZooKeeper.  Returns false if the region does not exist in ZK or is in
 * a different state.
 * <p>
 * Method synchronizes() with ZK so will yield an up-to-date result but is
 * a slow read.
 * @param zkw
 * @param region
 * @param expectedState
 * @return true if region exists and is in expected state
 * @throws DeserializationException
 */
static boolean verifyRegionState(ZooKeeperWatcher zkw, HRegionInfo region, EventType expectedState)
throws KeeperException, DeserializationException {
  String encoded = region.getEncodedName();

  String node = ZKAssign.getNodeName(zkw, encoded);
  zkw.sync(node);

  // Read existing data of the node
  byte [] existingBytes = null;
  try {
    existingBytes = ZKUtil.getDataAndWatch(zkw, node);
  } catch (KeeperException.NoNodeException nne) {
    return false;
  } catch (KeeperException e) {
    throw e;
  }
  if (existingBytes == null) return false;
  RegionTransition rt = RegionTransition.parseFrom(existingBytes);
  return rt.getEventType().equals(expectedState);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:Mocking.java


示例5: OpenRegion

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
private void OpenRegion(Server server, RegionServerServices rss,
    HTableDescriptor htd, HRegionInfo hri, OpenRegionCoordination coordination)
throws IOException, NodeExistsException, KeeperException, DeserializationException {
  // Create it OFFLINE node, which is what Master set before sending OPEN RPC
  ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName());

  OpenRegionCoordination.OpenRegionDetails ord =
    coordination.getDetailsForNonCoordinatedOpening();
  OpenRegionHandler openHandler =
    new OpenRegionHandler(server, rss, hri, htd, -1, coordination, ord);
  rss.getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE);
  openHandler.process();
  // This parse is not used?
  RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName()));
  // delete the node, which is what Master do after the region is opened
  ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(),
    EventType.RS_ZK_REGION_OPENED, server.getServerName());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestCloseRegionHandler.java


示例6: fakeRegionServerRegionOpenInZK

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * Fakes the regionserver-side zk transitions of a region open.
 * @param w ZooKeeperWatcher to use.
 * @param sn Name of the regionserver doing the 'opening'
 * @param hri Region we're 'opening'.
 * @throws KeeperException
 * @throws DeserializationException
 */
static void fakeRegionServerRegionOpenInZK(HMaster master,  final ZooKeeperWatcher w,
    final ServerName sn, final HRegionInfo hri)
  throws KeeperException, DeserializationException, InterruptedException {
  // Wait till the we region is ready to be open in RIT.
  waitForRegionPendingOpenInRIT(master.getAssignmentManager(), hri.getEncodedName());

  // Get current versionid else will fail on transition from OFFLINE to OPENING below
  int versionid = ZKAssign.getVersion(w, hri);
  assertNotSame(-1, versionid);
  // This uglyness below is what the openregionhandler on RS side does.  I
  // looked at exposing the method over in openregionhandler but its just a
  // one liner and its deep over in another package so just repeat it below.
  versionid = ZKAssign.transitionNode(w, hri, sn,
    EventType.M_ZK_REGION_OFFLINE, EventType.RS_ZK_REGION_OPENING, versionid);
  assertNotSame(-1, versionid);
  // Move znode from OPENING to OPENED as RS does on successful open.
  versionid = ZKAssign.transitionNodeOpened(w, hri, sn, versionid);
  assertNotSame(-1, versionid);
  // We should be done now.  The master open handler will notice the
  // transition and remove this regions znode.
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:30,代码来源:Mocking.java


示例7: OpenRegionHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
protected OpenRegionHandler(final Server server,
    final RegionServerServices rsServices, final HRegionInfo regionInfo,
    final HTableDescriptor htd, EventType eventType,
    final int versionOfOfflineNode) {
  super(server, eventType);
  this.rsServices = rsServices;
  this.regionInfo = regionInfo;
  this.htd = htd;
  this.versionOfOfflineNode = versionOfOfflineNode;
  tomActivated = this.server.getConfiguration().
    getBoolean(AssignmentManager.ASSIGNMENT_TIMEOUT_MANAGEMENT,
      AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_MANAGEMENT);
  assignmentTimeout = this.server.getConfiguration().
    getInt(AssignmentManager.ASSIGNMENT_TIMEOUT,
      AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_DEFAULT);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:OpenRegionHandler.java


示例8: createNodeSplitting

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * Creates a new ephemeral node in the SPLITTING state for the specified region.
 * Create it ephemeral in case regionserver dies mid-split.
 *
 * <p>Does not transition nodes from other states.  If a node already exists
 * for this region, a {@link NodeExistsException} will be thrown.
 *
 * @param zkw zk reference
 * @param region region to be created as offline
 * @param serverName server event originates from
 * @return Version of znode created.
 * @throws KeeperException
 * @throws IOException
 */
// Copied from SplitTransaction rather than open the method over there in
// the regionserver package.
private static int createNodeSplitting(final ZooKeeperWatcher zkw,
    final HRegionInfo region, final ServerName serverName)
throws KeeperException, IOException {
  RegionTransition rt =
    RegionTransition.createRegionTransition(EventType.RS_ZK_REGION_SPLITTING,
      region.getRegionName(), serverName);

  String node = ZKAssign.getNodeName(zkw, region.getEncodedName());
  if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, rt.toByteArray())) {
    throw new IOException("Failed create of ephemeral " + node);
  }
  // Transition node from SPLITTING to SPLITTING and pick up version so we
  // can be sure this znode is ours; version is needed deleting.
  return transitionNodeSplitting(zkw, region, serverName, -1);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:32,代码来源:TestAssignmentManager.java


示例9: OpenRegion

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
private void OpenRegion(Server server, RegionServerServices rss,
    HTableDescriptor htd, HRegionInfo hri, OpenRegionCoordination coordination)
throws IOException, NodeExistsException, KeeperException, DeserializationException {
  // Create it OFFLINE node, which is what Master set before sending OPEN RPC
  ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName());

  OpenRegionCoordination.OpenRegionDetails ord =
    coordination.getDetailsForNonCoordinatedOpening();
  OpenRegionHandler openHandler =
    new OpenRegionHandler(server, rss, hri, htd, coordination, ord);
  rss.getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE);
  openHandler.process();
  // This parse is not used?
  RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName()));
  // delete the node, which is what Master do after the region is opened
  ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(),
    EventType.RS_ZK_REGION_OPENED, server.getServerName());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:19,代码来源:TestCloseRegionHandler.java


示例10: testTransitionToFailedOpenFromOffline

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
@Test
public void testTransitionToFailedOpenFromOffline() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService(server.getServerName());
  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
  // Create the handler
  OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) {

    @Override
    boolean transitionZookeeperOfflineToOpening(String encodedName, int versionOfOfflineNode) {
      return false;
    }
  };
  rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);

  handler.process();

  RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(),
      TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:TestOpenRegionHandler.java


示例11: OpenedRegionHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public OpenedRegionHandler(Server server,
    AssignmentManager assignmentManager, HRegionInfo regionInfo,
    ServerName sn, int expectedVersion) {
  super(server, EventType.RS_ZK_REGION_OPENED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  this.sn = sn;
  this.expectedVersion = expectedVersion;
  if(regionInfo.isMetaRegion()) {
    priority = OpenedPriority.META;
  } else if(regionInfo.getTable()
      .getNamespaceAsString().equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
    priority = OpenedPriority.SYSTEM;
  } else {
    priority = OpenedPriority.USER;
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:OpenedRegionHandler.java


示例12: ServerShutdownHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
ServerShutdownHandler(final Server server, final MasterServices services,
    final DeadServer deadServers, final ServerName serverName, EventType type,
    final boolean shouldSplitHlog) {
  super(server, type);
  this.serverName = serverName;
  this.server = server;
  this.services = services;
  this.deadServers = deadServers;
  if (!this.deadServers.isDeadServer(this.serverName)) {
    LOG.warn(this.serverName + " is NOT in deadservers; it should be!");
  }
  this.shouldSplitHlog = shouldSplitHlog;
  this.distributedLogReplay = HLogSplitter.isDistributedLogReplay(server.getConfiguration());
  this.regionAssignmentWaitTimeout = server.getConfiguration().getInt(
    HConstants.LOG_REPLAY_WAIT_REGION_TIMEOUT, 15000);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:ServerShutdownHandler.java


示例13: transitionFromOfflineToOpening

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * Transition ZK node from OFFLINE to OPENING.
 * @param regionInfo region info instance
 * @param ord - instance of open region details, for ZK implementation
 *   will include version Of OfflineNode that needs to be compared
 *   before changing the node's state from OFFLINE
 * @return True if successful transition.
 */
@Override
public boolean transitionFromOfflineToOpening(HRegionInfo regionInfo,
                                              OpenRegionDetails ord) {
  ZkOpenRegionDetails zkOrd = (ZkOpenRegionDetails) ord;

  // encoded name is used as znode encoded name in ZK
  final String encodedName = regionInfo.getEncodedName();

  // TODO: should also handle transition from CLOSED?
  try {
    // Initialize the znode version.
    zkOrd.setVersion(ZKAssign.transitionNode(watcher, regionInfo,
      zkOrd.getServerName(), EventType.M_ZK_REGION_OFFLINE,
      EventType.RS_ZK_REGION_OPENING, zkOrd.getVersionOfOfflineNode()));
  } catch (KeeperException e) {
    LOG.error("Error transition from OFFLINE to OPENING for region=" +
      encodedName, e);
    zkOrd.setVersion(-1);
    return false;
  }
  boolean b = isGoodVersion(zkOrd);
  if (!b) {
    LOG.warn("Failed transition from OFFLINE to OPENING for region=" +
      encodedName);
  }
  return b;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:ZkOpenRegionCoordination.java


示例14: tryTransitionFromOfflineToFailedOpen

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * Try to transition to open.
 *
 * This is not guaranteed to succeed, we just do our best.
 *
 * @param rsServices
 * @param hri Region we're working on.
 * @param ord Details about region open task
 * @return whether znode is successfully transitioned to FAILED_OPEN state.
 */
@Override
public boolean tryTransitionFromOfflineToFailedOpen(RegionServerServices rsServices,
                                                    final HRegionInfo hri,
                                                    OpenRegionDetails ord) {
  ZkOpenRegionDetails zkOrd = (ZkOpenRegionDetails) ord;
  boolean result = false;
  final String name = hri.getRegionNameAsString();
  try {
    LOG.info("Opening of region " + hri + " failed, transitioning" +
      " from OFFLINE to FAILED_OPEN in ZK, expecting version " +
      zkOrd.getVersionOfOfflineNode());
    if (ZKAssign.transitionNode(
      rsServices.getZooKeeper(), hri,
      rsServices.getServerName(),
      EventType.M_ZK_REGION_OFFLINE,
      EventType.RS_ZK_REGION_FAILED_OPEN,
      zkOrd.getVersionOfOfflineNode()) == -1) {
      LOG.warn("Unable to mark region " + hri + " as FAILED_OPEN. " +
        "It's likely that the master already timed out this open " +
        "attempt, and thus another RS already has the region.");
    } else {
      result = true;
    }
  } catch (KeeperException e) {
    LOG.error("Failed transitioning node " + name + " from OFFLINE to FAILED_OPEN", e);
  }
  return result;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:ZkOpenRegionCoordination.java


示例15: tryTransitionFromOpeningToFailedOpen

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
/**
 * This is not guaranteed to succeed, we just do our best.
 * @param hri Region we're working on.
 * @return whether znode is successfully transitioned to FAILED_OPEN state.
 */
@Override
public boolean tryTransitionFromOpeningToFailedOpen(final HRegionInfo hri,
                                                    OpenRegionDetails ord) {
  ZkOpenRegionDetails zkOrd = (ZkOpenRegionDetails) ord;
  boolean result = false;
  final String name = hri.getRegionNameAsString();
  try {
    LOG.info("Opening of region " + hri + " failed, transitioning" +
      " from OPENING to FAILED_OPEN in ZK, expecting version " + zkOrd.getVersion());
    if (ZKAssign.transitionNode(
      watcher, hri,
      zkOrd.getServerName(),
      EventType.RS_ZK_REGION_OPENING,
      EventType.RS_ZK_REGION_FAILED_OPEN,
      zkOrd.getVersion()) == -1) {
      LOG.warn("Unable to mark region " + hri + " as FAILED_OPEN. " +
        "It's likely that the master already timed out this open " +
        "attempt, and thus another RS already has the region.");
    } else {
      result = true;
    }
  } catch (KeeperException e) {
    LOG.error("Failed transitioning node " + name +
      " from OPENING to FAILED_OPEN", e);
  }
  return result;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:ZkOpenRegionCoordination.java


示例16: DispatchMergingRegionHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public DispatchMergingRegionHandler(final MasterServices services,
    final CatalogJanitor catalogJanitor, final HRegionInfo region_a,
    final HRegionInfo region_b, final boolean forcible) {
  super(services, EventType.C_M_MERGE_REGION);
  this.masterServices = services;
  this.catalogJanitor = catalogJanitor;
  this.region_a = region_a;
  this.region_b = region_b;
  this.forcible = forcible;
  this.timeout = server.getConfiguration().getInt(
      "hbase.master.regionmerge.timeout", 120 * 1000);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:DispatchMergingRegionHandler.java


示例17: CreateTableHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public CreateTableHandler(Server server, MasterFileSystem fileSystemManager,
    HTableDescriptor hTableDescriptor, Configuration conf, HRegionInfo [] newRegions,
    MasterServices masterServices) {
  super(server, EventType.C_M_CREATE_TABLE);

  this.fileSystemManager = fileSystemManager;
  this.hTableDescriptor = hTableDescriptor;
  this.conf = conf;
  this.newRegions = newRegions;
  this.assignmentManager = masterServices.getAssignmentManager();
  this.tableLockManager = masterServices.getTableLockManager();

  this.tableLock = this.tableLockManager.writeLock(this.hTableDescriptor.getTableName()
      , EventType.C_M_CREATE_TABLE.toString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:CreateTableHandler.java


示例18: DisableTableHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public DisableTableHandler(Server server, TableName tableName,
    AssignmentManager assignmentManager, TableLockManager tableLockManager,
    boolean skipTableStateCheck) {
  super(server, EventType.C_M_DISABLE_TABLE);
  this.tableName = tableName;
  this.assignmentManager = assignmentManager;
  this.tableLockManager = tableLockManager;
  this.skipTableStateCheck = skipTableStateCheck;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:DisableTableHandler.java


示例19: EnableTableHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public EnableTableHandler(Server server, TableName tableName,
    AssignmentManager assignmentManager, TableLockManager tableLockManager,
    boolean skipTableStateCheck) {
  super(server, EventType.C_M_ENABLE_TABLE);
  this.tableName = tableName;
  this.assignmentManager = assignmentManager;
  this.tableLockManager = tableLockManager;
  this.skipTableStateCheck = skipTableStateCheck;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:EnableTableHandler.java


示例20: ClosedRegionHandler

import org.apache.hadoop.hbase.executor.EventType; //导入依赖的package包/类
public ClosedRegionHandler(Server server, AssignmentManager assignmentManager,
    HRegionInfo regionInfo) {
  super(server, EventType.RS_ZK_REGION_CLOSED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  if(regionInfo.isMetaRegion()) {
    priority = ClosedPriority.META;
  } else {
    priority = ClosedPriority.USER;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:ClosedRegionHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java KualiForm类代码示例发布时间:2022-05-22
下一篇:
Java HorizontalLayoutContainer类代码示例发布时间: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