Index: hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java (revision 1511867) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnection.java (working copy) @@ -106,6 +106,19 @@ * Note that the HConnection needs to be unmanaged * (created with {@link HConnectionManager#createConnection(Configuration)}). * @param tableName + * @return an HTable to use for interactions with this table + */ + public HTableInterface getTable(TableName tableName) throws IOException; + + /** + * Retrieve an HTableInterface implementation for access to a table. + * The returned HTableInterface is not thread safe, a new instance should + * be created for each using thread. + * This is a lightweight operation, pooling or caching of the returned HTableInterface + * is neither required nor desired. + * Note that the HConnection needs to be unmanaged + * (created with {@link HConnectionManager#createConnection(Configuration)}). + * @param tableName * @param pool The thread pool to use for batch operations, null to use a default pool. * @return an HTable to use for interactions with this table */ @@ -125,6 +138,20 @@ */ public HTableInterface getTable(byte[] tableName, ExecutorService pool) throws IOException; + /** + * Retrieve an HTableInterface implementation for access to a table. + * The returned HTableInterface is not thread safe, a new instance should + * be created for each using thread. + * This is a lightweight operation, pooling or caching of the returned HTableInterface + * is neither required nor desired. + * Note that the HConnection needs to be unmanaged + * (created with {@link HConnectionManager#createConnection(Configuration)}). + * @param tableName + * @param pool The thread pool to use for batch operations, null to use a default pool. + * @return an HTable to use for interactions with this table + */ + public HTableInterface getTable(TableName tableName, ExecutorService pool) throws IOException; + /** @return - true if the master server is running */ boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionException; Index: hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1511867) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -653,21 +653,31 @@ @Override public HTableInterface getTable(String tableName) throws IOException { - return getTable(Bytes.toBytes(tableName)); + return getTable(TableName.valueOf(tableName)); } @Override public HTableInterface getTable(byte[] tableName) throws IOException { + return getTable(TableName.valueOf(tableName)); + } + + @Override + public HTableInterface getTable(TableName tableName) throws IOException { return getTable(tableName, getBatchPool()); } @Override public HTableInterface getTable(String tableName, ExecutorService pool) throws IOException { - return getTable(Bytes.toBytes(tableName), pool); + return getTable(TableName.valueOf(tableName), pool); } @Override public HTableInterface getTable(byte[] tableName, ExecutorService pool) throws IOException { + return getTable(TableName.valueOf(tableName), pool); + } + + @Override + public HTableInterface getTable(TableName tableName, ExecutorService pool) throws IOException { if (managed) { throw new IOException("The connection has to be unmanaged."); } Index: hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionWrapper.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionWrapper.java (revision 1511867) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionWrapper.java (working copy) @@ -73,6 +73,11 @@ } @Override + public HTableInterface getTable(TableName tableName) throws IOException { + return hconnection.getTable(tableName); + } + + @Override public HTableInterface getTable(String tableName, ExecutorService pool) throws IOException { return hconnection.getTable(tableName, pool); } @@ -83,6 +88,11 @@ } @Override + public HTableInterface getTable(TableName tableName, ExecutorService pool) throws IOException { + return hconnection.getTable(tableName, pool); + } + + @Override public void abort(String why, Throwable e) { hconnection.abort(why, e); }