HBASE-10046 Unmonitored HBase service could accumulate Status objects and OOM

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1546094 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-11-27 16:32:58 +00:00
parent 69daad5a47
commit e77e82c5c1
1 changed files with 6 additions and 4 deletions

View File

@ -73,8 +73,9 @@ public class TaskMonitor {
new Class<?>[] { MonitoredTask.class },
new PassthroughInvocationHandler<MonitoredTask>(stat));
TaskAndWeakRefPair pair = new TaskAndWeakRefPair(stat, proxy);
synchronized (this) {
tasks.add(pair);
tasks.add(pair);
if (tasks.size() > MAX_TASKS) {
purgeExpiredTasks();
}
return proxy;
}
@ -87,8 +88,9 @@ public class TaskMonitor {
new Class<?>[] { MonitoredRPCHandler.class },
new PassthroughInvocationHandler<MonitoredRPCHandler>(stat));
TaskAndWeakRefPair pair = new TaskAndWeakRefPair(stat, proxy);
synchronized (this) {
tasks.add(pair);
tasks.add(pair);
if (tasks.size() > MAX_TASKS) {
purgeExpiredTasks();
}
return proxy;
}