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


Java HConnectable类代码示例

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


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

示例1: loadDisabledTables

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的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>(getConf()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      ZooKeeperWatcher zkw = connection.getZooKeeperWatcher();
      try {
        for (String tableName : ZKTableReadOnly.getDisabledOrDisablingTables(zkw)) {
          disabledTables.add(Bytes.toBytes(tableName));
        }
      } catch (KeeperException ke) {
        throw new IOException(ke);
      }
      return null;
    }
  });
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:23,代码来源:HBaseFsck.java

示例2: loadDisabledTables

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的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

示例3: metaScan

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Scans the meta table and calls a visitor on each RowResult. Uses a table
 * name and a row name to locate meta regions. And it only scans at most
 * <code>rowLimit</code> of rows.
 *
 * @param configuration HBase configuration.
 * @param visitor Visitor object. Closes the visitor before returning.
 * @param tableName User table name in meta table to start scan at.  Pass
 * null if not interested in a particular table.
 * @param row Name of the row at the user table. The scan will start from
 * the region row where the row resides.
 * @param rowLimit Max of processed rows. If it is less than 0, it
 * will be set to default value <code>Integer.MAX_VALUE</code>.
 * @param metaTableName Meta table to scan, root or meta.
 * @throws IOException e
 */
public static void metaScan(Configuration configuration,
    final MetaScannerVisitor visitor, final byte[] tableName,
    final byte[] row, final int rowLimit, final byte[] metaTableName)
    throws IOException {
  try {
    HConnectionManager.execute(new HConnectable<Void>(configuration) {
      @Override
      public Void connect(HConnection connection) throws IOException {
        metaScan(conf, connection, visitor, tableName, row, rowLimit,
            metaTableName);
        return null;
      }
    });
  } finally {
    visitor.close();
  }
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:34,代码来源:MetaScanner.java

示例4: loadDisabledTables

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的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>(getConf()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      ZooKeeperWatcher zkw = createZooKeeperWatcher();
      try {
        for (String tableName : ZKTableReadOnly.getDisabledOrDisablingTables(zkw)) {
          disabledTables.add(Bytes.toBytes(tableName));
        }
      } catch (KeeperException ke) {
        throw new IOException(ke);
      } finally {
        zkw.close();
      }
      return null;
    }
  });
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:25,代码来源:HBaseFsck.java

示例5: loadDisabledTables

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的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>(getConf()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      ZooKeeperWatcher zkw = connection.getZooKeeperWatcher();
      try {
        for (Entry<TableState, Set<String>> e : ZKTableReadOnly.getDisabledOrDisablingTables(zkw)
            .entrySet()) {
          for (String tableName : e.getValue()) {
            disabledTables.add(Bytes.toBytes(tableName));
          }
        }
      } catch (KeeperException ke) {
        throw new IOException(ke);
      }
      return null;
    }
  });
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:26,代码来源:HBaseFsck.java

示例6: isTableEnabled

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Tells whether or not a table is enabled or not.
 * @param conf The Configuration object to use.
 * @param tableName Name of table to check.
 * @return {@code true} if table is online.
 * @throws IOException if a remote or network exception occurs
 */
public static boolean isTableEnabled(Configuration conf, final byte[] tableName)
    throws IOException {
  return HConnectionManager.execute(new HConnectable<Boolean>(conf) {
    @Override
    public Boolean connect(HConnection connection) throws IOException {
      return connection.isTableEnabled(tableName);
    }
  });
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:HTable.java

示例7: setRegionCachePrefetch

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Enable or disable region cache prefetch for the table. It will be applied for the given table's
 * all HTable instances who share the same connection. By default, the cache prefetch is enabled.
 * @param tableName name of table to configure.
 * @param enable Set to true to enable region cache prefetch. Or set to false to disable it.
 * @throws IOException
 */
public static void setRegionCachePrefetch(final byte[] tableName, final boolean enable)
    throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(HBaseConfiguration.create()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:HTable.java

示例8: getRegionCachePrefetch

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Check whether region cache prefetch is enabled or not for the table.
 * @param conf The Configuration object to use.
 * @param tableName name of table to check
 * @return true if table's region cache prefecth is enabled. Otherwise it is disabled.
 * @throws IOException
 */
public static boolean getRegionCachePrefetch(final Configuration conf, final byte[] tableName)
    throws IOException {
  return HConnectionManager.execute(new HConnectable<Boolean>(conf) {
    @Override
    public Boolean connect(HConnection connection) throws IOException {
      return connection.getRegionCachePrefetch(tableName);
    }
  });
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:HTable.java

示例9: merge

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Scans the table and merges two adjacent regions if they are small. This
 * only happens when a lot of rows are deleted.
 *
 * When merging the META region, the HBase instance must be offline.
 * When merging a normal table, the HBase instance must be online, but the
 * table must be disabled.
 *
 * @param conf        - configuration object for HBase
 * @param fs          - FileSystem where regions reside
 * @param tableName   - Table to be compacted
 * @param testMasterRunning True if we are to verify master is down before
 * running merge
 * @throws IOException
 */
public static void merge(Configuration conf, FileSystem fs,
  final byte [] tableName, final boolean testMasterRunning)
throws IOException {
  boolean masterIsRunning = false;
  if (testMasterRunning) {
    masterIsRunning = HConnectionManager
        .execute(new HConnectable<Boolean>(conf) {
          @Override
          public Boolean connect(HConnection connection) throws IOException {
            return connection.isMasterRunning();
          }
        });
  }
  if (Bytes.equals(tableName, HConstants.META_TABLE_NAME)) {
    if (masterIsRunning) {
      throw new IllegalStateException(
          "Can not compact META table if instance is on-line");
    }
    new OfflineMerger(conf, fs).process();
  } else {
    if(!masterIsRunning) {
      throw new IllegalStateException(
          "HBase instance must be running to merge a normal table");
    }
    HBaseAdmin admin = new HBaseAdmin(conf);
    if (!admin.isTableDisabled(tableName)) {
      throw new TableNotDisabledException(tableName);
    }
    new OnlineMerger(conf, fs, tableName).process();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:47,代码来源:HMerge.java

示例10: isTableEnabled

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Tells whether or not a table is enabled or not.
 * @param conf The Configuration object to use.
 * @param tableName Name of table to check.
 * @return {@code true} if table is online.
 * @throws IOException if a remote or network exception occurs
 */
public static boolean isTableEnabled(Configuration conf,
    final byte[] tableName) throws IOException {
  return HConnectionManager.execute(new HConnectable<Boolean>(conf) {
    @Override
    public Boolean connect(HConnection connection) throws IOException {
      return connection.isTableEnabled(tableName);
    }
  });
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:17,代码来源:HTable.java

示例11: setRegionCachePrefetch

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Enable or disable region cache prefetch for the table. It will be
 * applied for the given table's all HTable instances who share the same
 * connection. By default, the cache prefetch is enabled.
 * @param tableName name of table to configure.
 * @param enable Set to true to enable region cache prefetch. Or set to
 * false to disable it.
 * @throws IOException
 */
public static void setRegionCachePrefetch(final byte[] tableName,
    final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(HBaseConfiguration
      .create()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:21,代码来源:HTable.java

示例12: getRegionCachePrefetch

import org.apache.hadoop.hbase.client.HConnectionManager.HConnectable; //导入依赖的package包/类
/**
 * Check whether region cache prefetch is enabled or not for the table.
 * @param conf The Configuration object to use.
 * @param tableName name of table to check
 * @return true if table's region cache prefecth is enabled. Otherwise
 * it is disabled.
 * @throws IOException
 */
public static boolean getRegionCachePrefetch(final Configuration conf,
    final byte[] tableName) throws IOException {
  return HConnectionManager.execute(new HConnectable<Boolean>(conf) {
    @Override
    public Boolean connect(HConnection connection) throws IOException {
      return connection.getRegionCachePrefetch(tableName);
    }
  });
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:18,代码来源:HTable.java


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