hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1357299 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/client/HTablePool.java test/java/org/apache/hadoop/hbase/client/TestHTablePool.java
Date Wed, 04 Jul 2012 15:11:39 GMT
Author: stack
Date: Wed Jul  4 15:11:38 2012
New Revision: 1357299

URL: http://svn.apache.org/viewvc?rev=1357299&view=rev
Log:
HBASE-6322 Unnecessary creation of finalizers in HTablePool; REVERT -- DOESN'T BELONG ON THIS
BRANCH

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java?rev=1357299&r1=1357298&r2=1357299&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java Wed Jul
 4 15:11:38 2012
@@ -320,11 +320,12 @@ public class HTablePool implements Close
    * wrapped table back to the table pool
    * 
    */
-  class PooledHTable implements HTableInterface {
+  class PooledHTable extends HTable {
 
     private HTableInterface table; // actual table implementation
 
     public PooledHTable(HTableInterface table) throws IOException {
+      super(table.getConfiguration(), table.getTableName());
       this.table = table;
     }
 

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java?rev=1357299&r1=1357298&r2=1357299&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java Wed
Jul  4 15:11:38 2012
@@ -183,6 +183,22 @@ public class TestHTablePool {
         Assert.assertTrue("alien table rejected", true);
       }
     }
+
+    @Test
+    public void testClassCastException() {
+      //this test makes sure that client code that
+      //casts the table it got from pool to HTable won't break
+      HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
+        Integer.MAX_VALUE);
+      String tableName = Bytes.toString(TABLENAME);
+      try {
+        // get table and check if type is HTable
+        HTable table = (HTable) pool.getTable(tableName);
+        Assert.assertTrue("return type is HTable as expected", true);
+      } catch (ClassCastException e) {
+        Assert.fail("return type is not HTable");
+      }
+    }
   }
 
   @Category(MediumTests.class)



Mime
View raw message