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


Java ZKTable类代码示例

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


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

示例1: AssignmentManager

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Constructs a new assignment manager.
 *
 * @param master
 * @param serverManager
 * @param catalogTracker
 * @param service
 * @throws KeeperException
 * @throws IOException 
 */
public AssignmentManager(Server master, ServerManager serverManager,
    CatalogTracker catalogTracker, final LoadBalancer balancer,
    final ExecutorService service) throws KeeperException, IOException {
  super(master.getZooKeeper());
  this.master = master;
  this.serverManager = serverManager;
  this.catalogTracker = catalogTracker;
  this.executorService = service;
  this.regionsToReopen = Collections.synchronizedMap
                         (new HashMap<String, HRegionInfo> ());
  Configuration conf = master.getConfiguration();
  this.timeoutMonitor = new TimeoutMonitor(
    conf.getInt("hbase.master.assignment.timeoutmonitor.period", 10000),
    master, serverManager,
    conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000));
  this.timerUpdater = new TimerUpdater(conf.getInt(
      "hbase.master.assignment.timerupdater.period", 10000), master);
  Threads.setDaemonThreadRunning(timerUpdater.getThread(),
      master.getServerName() + ".timerUpdater");
  this.zkTable = new ZKTable(this.master.getZooKeeper());
  this.maximumAssignmentAttempts =
    this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
  this.balancer = balancer;
  this.threadPoolExecutorService = Executors.newCachedThreadPool();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:36,代码来源:AssignmentManager.java

示例2: recoverTableInEnablingState

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Recover the tables that are not fully moved to ENABLED state. These tables
 * are in ENABLING state when the master restarted/switched
 *
 * @throws KeeperException
 * @throws org.apache.hadoop.hbase.TableNotFoundException
 * @throws IOException
 */
private void recoverTableInEnablingState()
    throws KeeperException, TableNotFoundException, IOException {
  Set<TableName> enablingTables = ZKTable.getEnablingTables(watcher);
  if (enablingTables.size() != 0) {
    for (TableName tableName : enablingTables) {
      // Recover by calling EnableTableHandler
      LOG.info("The table " + tableName
          + " is in ENABLING state.  Hence recovering by moving the table"
          + " to ENABLED state.");
      // enableTable in sync way during master startup,
      // no need to invoke coprocessor
      EnableTableHandler eth = new EnableTableHandler(this.server, tableName,
        catalogTracker, this, tableLockManager, true);
      try {
        eth.prepare();
      } catch (TableNotFoundException e) {
        LOG.warn("Table " + tableName + " not found in hbase:meta to recover.");
        continue;
      }
      eth.process();
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:32,代码来源:AssignmentManager.java

示例3: waitUntilTableDisabled

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private boolean waitUntilTableDisabled(long timeout, TableName tableName, ZKTable zk) {
  long startTime = System.currentTimeMillis();
  long remaining = timeout;
  boolean disabled = false;
  while (!(disabled = zk.isDisabledTable(tableName)) && remaining > 0) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while waiting for table" + tableName + " set to DISABLED.");
      }
    }
    remaining = timeout - (System.currentTimeMillis() - startTime);
  }
  if (remaining <= 0) {
    return disabled;
  } else {
    return true;
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:IndexMasterObserver.java

示例4: waitUntilTableEnabled

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private boolean waitUntilTableEnabled(long timeout, TableName tableName, ZKTable zk) {
  long startTime = System.currentTimeMillis();
  long remaining = timeout;
  boolean enabled = false;
  while (!(enabled = zk.isEnabledTable(tableName)) && remaining > 0) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while waiting for table " + tableName + "state set to ENABLED.");
      }
    }
    remaining = timeout - (System.currentTimeMillis() - startTime);
  }
  if (remaining <= 0) {
    return enabled;
  } else {
    return true;
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:IndexMasterObserver.java

示例5: testTableOnlineState

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private boolean testTableOnlineState(byte [] tableName, boolean online)
throws IOException {
  if (Bytes.equals(tableName, HConstants.ROOT_TABLE_NAME)) {
    // The root region is always enabled
    return online;
  }
  String tableNameStr = Bytes.toString(tableName);
  try {
    if (online) {
      return ZKTable.isEnabledTable(this.zooKeeper, tableNameStr);
    }
    return ZKTable.isDisabledTable(this.zooKeeper, tableNameStr);
  } catch (KeeperException e) {
    throw new IOException("Enable/Disable failed", e);
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:17,代码来源:HConnectionManager.java

示例6: AssignmentManager

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Constructs a new assignment manager.
 *
 * @param master
 * @param serverManager
 * @param catalogTracker
 * @param service
 * @throws KeeperException
 * @throws IOException 
 */
public AssignmentManager(Server master, ServerManager serverManager,
    CatalogTracker catalogTracker, final ExecutorService service)
throws KeeperException, IOException {
  super(master.getZooKeeper());
  this.master = master;
  this.serverManager = serverManager;
  this.catalogTracker = catalogTracker;
  this.executorService = service;
  this.regionsToReopen = Collections.synchronizedMap
                         (new HashMap<String, HRegionInfo> ());
  Configuration conf = master.getConfiguration();
  this.timeoutMonitor = new TimeoutMonitor(
    conf.getInt("hbase.master.assignment.timeoutmonitor.period", 10000),
    master, serverManager,
    conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000));
  Threads.setDaemonThreadRunning(timeoutMonitor.getThread(),
    master.getServerName() + ".timeoutMonitor");
  this.zkTable = new ZKTable(this.master.getZooKeeper());
  this.maximumAssignmentAttempts =
    this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
  this.balancer = LoadBalancerFactory.getLoadBalancer(conf);
  this.threadPoolExecutorService = Executors.newCachedThreadPool();
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:34,代码来源:AssignmentManager.java

示例7: loadDisabledTables

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Load the list of disabled tables in ZK into local set.
 * @throws ZooKeeperConnectionException
 * @throws IOException
 */
private void loadDisabledTables()
throws ZooKeeperConnectionException, IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      ZooKeeperWatcher zkw = connection.getZooKeeperWatcher();
      try {
        for (String tableName : ZKTable.getDisabledOrDisablingTables(zkw)) {
          disabledTables.add(Bytes.toBytes(tableName));
        }
      } catch (KeeperException ke) {
        throw new IOException(ke);
      }
      return null;
    }
  });
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:23,代码来源:HBaseFsck.java

示例8: recoverTableInEnablingState

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Recover the tables that are not fully moved to ENABLED state. These tables
 * are in ENABLING state when the master restarted/switched
 *
 * @throws KeeperException
 * @throws org.apache.hadoop.hbase.TableNotFoundException
 * @throws IOException
 */
private void recoverTableInEnablingState()
    throws KeeperException, TableNotFoundException, IOException {
  Set<TableName> enablingTables = ZKTable.getEnablingTables(watcher);
  if (enablingTables.size() != 0) {
    for (TableName tableName : enablingTables) {
      // Recover by calling EnableTableHandler
      LOG.info("The table " + tableName
          + " is in ENABLING state.  Hence recovering by moving the table"
          + " to ENABLED state.");
      // enableTable in sync way during master startup,
      // no need to invoke coprocessor
      new EnableTableHandler(this.server, tableName,
          catalogTracker, this, tableLockManager, true).prepare().process();
    }
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:25,代码来源:AssignmentManager.java

示例9: recoverTableInEnablingState

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Recover the tables that are not fully moved to ENABLED state. These tables
 * are in ENABLING state when the master restarted/switched
 *
 * @throws KeeperException
 * @throws TableNotFoundException
 * @throws IOException
 */
private void recoverTableInEnablingState()
    throws KeeperException, TableNotFoundException, IOException {
  Set<String> enablingTables = ZKTable.getEnablingTables(watcher);
  if (enablingTables.size() != 0) {
    for (String tableName : enablingTables) {
      // Recover by calling EnableTableHandler
      LOG.info("The table " + tableName
          + " is in ENABLING state.  Hence recovering by moving the table"
          + " to ENABLED state.");
      // enableTable in sync way during master startup,
      // no need to invoke coprocessor
      new EnableTableHandler(this.server, tableName.getBytes(),
          catalogTracker, this, true).process();
    }
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:25,代码来源:AssignmentManager.java

示例10: waitUntilTableDisabled

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private boolean waitUntilTableDisabled(long timeout, String tableName, ZKTable zk) {
  long startTime = System.currentTimeMillis();
  long remaining = timeout;
  boolean disabled = false;
  while (!(disabled = zk.isDisabledTable(tableName)) && remaining > 0) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while waiting for table" + tableName + " set to DISABLED.");
      }
    }
    remaining = timeout - (System.currentTimeMillis() - startTime);
  }
  if (remaining <= 0) {
    return disabled;
  } else {
    return true;
  }
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:21,代码来源:IndexMasterObserver.java

示例11: waitUntilTableEnabled

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private boolean waitUntilTableEnabled(long timeout, String tableName, ZKTable zk) {
  long startTime = System.currentTimeMillis();
  long remaining = timeout;
  boolean enabled = false;
  while (!(enabled = zk.isEnabledTable(tableName)) && remaining > 0) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while waiting for table " + tableName + "state set to ENABLED.");
      }
    }
    remaining = timeout - (System.currentTimeMillis() - startTime);
  }
  if (remaining <= 0) {
    return enabled;
  } else {
    return true;
  }

}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:22,代码来源:IndexMasterObserver.java

示例12: assignAllUserRegions

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Assigns all user regions, if any exist.  Used during cluster startup.
 * <p>
 * This is a synchronous call and will return once every region has been
 * assigned.  If anything fails, an exception is thrown and the cluster
 * should be shutdown.
 * @throws InterruptedException
 * @throws IOException
 * @throws KeeperException
 */
private void assignAllUserRegions()
    throws IOException, InterruptedException, KeeperException {
  // Cleanup any existing ZK nodes and start watching
  ZKAssign.deleteAllNodes(watcher);
  ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
    this.watcher.assignmentZNode);
  failoverCleanupDone();

  // Skip assignment for regions of tables in DISABLING state because during clean cluster startup
  // no RS is alive and regions map also doesn't have any information about the regions.
  // See HBASE-6281.
  Set<TableName> disabledOrDisablingOrEnabling = ZKTable.getDisabledOrDisablingTables(watcher);
  disabledOrDisablingOrEnabling.addAll(ZKTable.getEnablingTables(watcher));
  // Scan hbase:meta for all user regions, skipping any disabled tables
  Map<HRegionInfo, ServerName> allRegions;
  SnapshotOfRegionAssignmentFromMeta snapshotOfRegionAssignment =
     new SnapshotOfRegionAssignmentFromMeta(catalogTracker, disabledOrDisablingOrEnabling, true);
  snapshotOfRegionAssignment.initialize();
  allRegions = snapshotOfRegionAssignment.getRegionToRegionServerMap();
  if (allRegions == null || allRegions.isEmpty()) return;

  // Determine what type of assignment to do on startup
  boolean retainAssignment = server.getConfiguration().
    getBoolean("hbase.master.startup.retainassign", true);

  if (retainAssignment) {
    assign(allRegions);
  } else {
    List<HRegionInfo> regions = new ArrayList<HRegionInfo>(allRegions.keySet());
    assign(regions);
  }

  for (HRegionInfo hri : allRegions.keySet()) {
    TableName tableName = hri.getTable();
    if (!zkTable.isEnabledTable(tableName)) {
      setEnabledTable(tableName);
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:50,代码来源:AssignmentManager.java

示例13: recoverTableInDisablingState

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
/**
 * Recover the tables that were not fully moved to DISABLED state. These
 * tables are in DISABLING state when the master restarted/switched.
 *
 * @throws KeeperException
 * @throws TableNotFoundException
 * @throws IOException
 */
private void recoverTableInDisablingState()
    throws KeeperException, TableNotFoundException, IOException {
  Set<TableName> disablingTables = ZKTable.getDisablingTables(watcher);
  if (disablingTables.size() != 0) {
    for (TableName tableName : disablingTables) {
      // Recover by calling DisableTableHandler
      LOG.info("The table " + tableName
          + " is in DISABLING state.  Hence recovering by moving the table"
          + " to DISABLED state.");
      new DisableTableHandler(this.server, tableName, catalogTracker,
          this, tableLockManager, true).prepare().process();
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:AssignmentManager.java

示例14: setTablesInZK

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private void setTablesInZK() throws IOException, KeeperException {
  if (tablesToBeSetInZK != null && !tablesToBeSetInZK.isEmpty()) {
    ZKTable zkTable = new ZKTable(this.watcher);
    for (Pair<String, State> p : tablesToBeSetInZK) {
      setStateInZK(zkTable, p.getFirst(), p.getSecond());
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:9,代码来源:SecondaryIndexColocator.java

示例15: setStateInZK

import org.apache.hadoop.hbase.zookeeper.ZKTable; //导入依赖的package包/类
private void setStateInZK(ZKTable zkTable, String tableName, State state) throws IOException,
    KeeperException {
  if (state == State.ENABLED) {
    zkTable.setEnabledTable(TableName.valueOf(tableName));
  }
  if (state == State.DISABLED) {
    zkTable.setDisabledTable(TableName.valueOf(tableName));
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:10,代码来源:SecondaryIndexColocator.java


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