HBASE-4283 HBaseAdmin never recovers from restarted cluster (Lars Hofhansl)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1163719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-08-31 17:50:33 +00:00
parent 6fbc5260af
commit 3080fb6f02
3 changed files with 12 additions and 1 deletions

View File

@ -229,6 +229,7 @@ Release 0.91.0 - Unreleased
HBASE-4303 HRegionInfo.toString has bad quoting (todd)
HBASE-4307 race condition in CacheTestUtils (Li Pi)
HBASE-4310 SlabCache metrics bugfix (Li Pi)
HBASE-4283 HBaseAdmin never recovers from restarted cluster (Lars Hofhansl)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -104,6 +104,9 @@ public class HBaseAdmin implements Abortable, Closeable {
try {
this.connection.getMaster();
break;
} catch (MasterNotRunningException mnre) {
HConnectionManager.deleteStaleConnection(this.connection);
this.connection = HConnectionManager.getConnection(this.conf);
} catch (UndeclaredThrowableException ute) {
HConnectionManager.deleteStaleConnection(this.connection);
this.connection = HConnectionManager.getConnection(this.conf);

View File

@ -93,7 +93,14 @@ public class PoolMap<K, V> implements Map<K, V> {
public boolean remove(K key, V value) {
Pool<V> pool = pools.get(key);
return pool != null ? pool.remove(value) : false;
boolean res = false;
if (pool != null) {
res = pool.remove(value);
if (res && pool.size() == 0) {
pools.remove(key);
}
}
return res;
}
@Override