Java 类org.apache.hadoop.hbase.client.HConnectionManager.HConnectable 实例源码

项目:LCIndex-HBase-0.94.16    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:IRIndex    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:RStore    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:HBase-Research    文件:MetaScanner.java   
/**
 * 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();
  }
}
项目:HBase-Research    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:hbase-0.94.8-qod    文件:MetaScanner.java   
/**
 * 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();
  }
}
项目:hbase-0.94.8-qod    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:hbase-0.94.8-qod    文件:MetaScanner.java   
/**
 * 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();
  }
}
项目:hbase-0.94.8-qod    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:DominoHBase    文件:MetaScanner.java   
/**
 * 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();
  }
}
项目:DominoHBase    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:hindex    文件:MetaScanner.java   
/**
 * 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();
  }
}
项目:hindex    文件:HBaseFsck.java   
/**
 * 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;
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HTable.java   
/**
 * 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;
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HTable.java   
/**
 * 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 conf The Configuration object to use.
 * @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 Configuration conf, final byte[] tableName,
    final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HTable.java   
/**
 * Check whether region cache prefetch is enabled or not for the table.
 * @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 byte[] tableName) throws IOException {
  return HConnectionManager.execute(new HConnectable<Boolean>(HBaseConfiguration.create()) {
    @Override
    public Boolean connect(HConnection connection) throws IOException {
      return connection.getRegionCachePrefetch(tableName);
    }
  });
}
项目:LCIndex-HBase-0.94.16    文件:HMerge.java   
/**
 * 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();
  }
}
项目:IRIndex    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:IRIndex    文件:HTable.java   
/**
 * 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;
    }
  });
}
项目:IRIndex    文件:HTable.java   
/**
 * 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 conf The Configuration object to use.
 * @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 Configuration conf,
    final byte[] tableName, final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
项目:IRIndex    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:IRIndex    文件:HTable.java   
/**
  * Check whether region cache prefetch is enabled or not for the table.
  * @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 byte[] tableName) throws IOException {
   return HConnectionManager.execute(new HConnectable<Boolean>(
       HBaseConfiguration.create()) {
     @Override
     public Boolean connect(HConnection connection) throws IOException {
       return connection.getRegionCachePrefetch(tableName);
     }
   });
}
项目:IRIndex    文件:HMerge.java   
/**
 * 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();
  }
}
项目:RStore    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:RStore    文件:HTable.java   
/**
 * 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;
    }
  });
}
项目:RStore    文件:HTable.java   
/**
 * 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 conf The Configuration object to use.
 * @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 Configuration conf,
    final byte[] tableName, final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
项目:RStore    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:RStore    文件:HTable.java   
/**
  * Check whether region cache prefetch is enabled or not for the table.
  * @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 byte[] tableName) throws IOException {
   return HConnectionManager.execute(new HConnectable<Boolean>(
       HBaseConfiguration.create()) {
     @Override
     public Boolean connect(HConnection connection) throws IOException {
       return connection.getRegionCachePrefetch(tableName);
     }
   });
}
项目:RStore    文件:HMerge.java   
/**
 * 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();
  }
}
项目:HBase-Research    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:HBase-Research    文件:HTable.java   
/**
 * 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;
    }
  });
}
项目:HBase-Research    文件:HTable.java   
/**
 * 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 conf The Configuration object to use.
 * @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 Configuration conf,
    final byte[] tableName, final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}
项目:HBase-Research    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:HBase-Research    文件:HTable.java   
/**
  * Check whether region cache prefetch is enabled or not for the table.
  * @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 byte[] tableName) throws IOException {
   return HConnectionManager.execute(new HConnectable<Boolean>(
       HBaseConfiguration.create()) {
     @Override
     public Boolean connect(HConnection connection) throws IOException {
       return connection.getRegionCachePrefetch(tableName);
     }
   });
}
项目:HBase-Research    文件:HMerge.java   
/**
 * 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();
  }
}
项目:hbase-0.94.8-qod    文件:HTable.java   
/**
 * 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);
    }
  });
}
项目:hbase-0.94.8-qod    文件:HTable.java   
/**
 * 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;
    }
  });
}
项目:hbase-0.94.8-qod    文件:HTable.java   
/**
 * 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 conf The Configuration object to use.
 * @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 Configuration conf,
    final byte[] tableName, final boolean enable) throws IOException {
  HConnectionManager.execute(new HConnectable<Void>(conf) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      connection.setRegionCachePrefetch(tableName, enable);
      return null;
    }
  });
}