HBASE-3750 HTable.putTable() should release resources for discarded tables

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1090748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Helmling 2011-04-10 07:58:37 +00:00
parent 4d3ce22c15
commit c81146580a
2 changed files with 8 additions and 4 deletions

View File

@ -186,6 +186,8 @@ Release 0.90.3 - Unreleased
HBASE-3740 hbck doesn't reset the number of errors when retrying HBASE-3740 hbck doesn't reset the number of errors when retrying
HBASE-3744 createTable blocks until all regions are out of transition HBASE-3744 createTable blocks until all regions are out of transition
(Ted Yu via Stack) (Ted Yu via Stack)
HBASE-3750 HTablePool.putTable() should call releaseHTableInterface()
for discarded tables (Ted Yu via garyh)
IMPROVEMENTS IMPROVEMENTS
HBASE-3747 ReplicationSource should differanciate remote and local exceptions HBASE-3747 ReplicationSource should differanciate remote and local exceptions

View File

@ -19,11 +19,9 @@
*/ */
package org.apache.hadoop.hbase.client; package org.apache.hadoop.hbase.client;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Map; import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
@ -118,7 +116,11 @@ public class HTablePool {
*/ */
public void putTable(HTableInterface table) { public void putTable(HTableInterface table) {
Queue<HTableInterface> queue = tables.get(Bytes.toString(table.getTableName())); Queue<HTableInterface> queue = tables.get(Bytes.toString(table.getTableName()));
if(queue.size() >= maxSize) return; if(queue.size() >= maxSize) {
// release table instance since we're not reusing it
this.tableFactory.releaseHTableInterface(table);
return;
}
queue.add(table); queue.add(table);
} }