You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/01/15 23:12:40 UTC
[2/3] accumulo git commit: ACCUMULO-2997 Improve comment about race
condition
ACCUMULO-2997 Improve comment about race condition
Improves the comment in the threadpool size adjustment code, to clarify what the
race condition is, and why it's not really a problem.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2016ab93
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2016ab93
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2016ab93
Branch: refs/heads/1.6
Commit: 2016ab93cc8960bf9aea0d196cb2297abf6c74ad
Parents: 87eec6f
Author: Christopher Tubbs <ct...@apache.org>
Authored: Thu Jan 15 16:07:38 2015 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Thu Jan 15 16:07:38 2015 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/server/util/TServerUtils.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/2016ab93/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java b/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
index bece746..ba93227 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
@@ -221,6 +221,8 @@ public class TServerUtils {
SimpleTimer.getInstance().schedule(new Runnable() {
@Override
public void run() {
+ // there is a minor race condition between sampling the current state of the thread pool and adjusting it
+ // however, this isn't really an issue, since it adjusts periodically anyway
if (pool.getCorePoolSize() <= pool.getActiveCount()) {
int larger = pool.getCorePoolSize() + Math.min(pool.getQueue().size(), 2);
log.info("Increasing server thread pool size on " + serverName + " to " + larger);
@@ -230,10 +232,6 @@ public class TServerUtils {
if (pool.getCorePoolSize() > pool.getActiveCount() + 3) {
int smaller = Math.max(numThreads, pool.getCorePoolSize() - 1);
if (smaller != pool.getCorePoolSize()) {
- // ACCUMULO-2997 there is a race condition here... the active count could be higher by the time
- // we decrease the core pool size... so the active count could end up higher than
- // the core pool size, in which case everything will be queued... the increase case
- // should handle this and prevent deadlock
log.info("Decreasing server thread pool size on " + serverName + " to " + smaller);
pool.setCorePoolSize(smaller);
}