You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/09/30 16:45:38 UTC
[18/50] [abbrv] ambari git commit: AMBARI-13245. RU cluster in hung
state while trying to perform downgrade (ncole)
AMBARI-13245. RU cluster in hung state while trying to perform downgrade (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/631ea43d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/631ea43d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/631ea43d
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 631ea43d6a82ebf13002ca26bfd57c7083a6996c
Parents: e3b0c36
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Sep 25 15:33:10 2015 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Sep 25 16:23:06 2015 -0400
----------------------------------------------------------------------
.../apache/ambari/server/utils/Parallel.java | 34 ++++++++++++--------
1 file changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/631ea43d/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
index a67ee5c..9ca039b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
@@ -19,22 +19,21 @@ package org.apache.ambari.server.utils;
import java.util.Arrays;
import java.util.Collections;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.LinkedList;
+import java.util.List;
import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
import java.util.concurrent.CompletionService;
-import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.ThreadFactory;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,12 +47,14 @@ public class Parallel {
/**
* Max pool size
*/
- private static final int MAX_POOL_SIZE = Math.max(2, Runtime.getRuntime().availableProcessors());
+ private static final int MAX_POOL_SIZE = Math.max(8, Runtime.getRuntime().availableProcessors());
/**
- * Keep alive time (1 sec)
+ * Keep alive time (15 min)
*/
- private static final int KEEP_ALIVE_TIME_MILLISECONDS = 1000;
+ // !!! changed from 1 second because EclipseLink was making threads idle and
+ // they kept timing out
+ private static final int KEEP_ALIVE_TIME_MINUTES = 15;
/**
* Poll duration (10 secs)
@@ -61,6 +62,11 @@ public class Parallel {
private static final int POLL_DURATION_MILLISECONDS = 10000;
/**
+ * Core pool size
+ */
+ private static final int CORE_POOL_SIZE = 2;
+
+ /**
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(Parallel.class);
@@ -81,10 +87,10 @@ public class Parallel {
// Create thread pool
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(
- 0, // Core pool size
+ CORE_POOL_SIZE, // Core pool size
MAX_POOL_SIZE, // Max pool size
- KEEP_ALIVE_TIME_MILLISECONDS, // Keep alive time for idle threads
- TimeUnit.MILLISECONDS,
+ KEEP_ALIVE_TIME_MINUTES, // Keep alive time for idle threads
+ TimeUnit.MINUTES,
blockingQueue, // Using synchronous queue
new ParallelLoopsThreadFactory(), // Thread pool factory to use
new ThreadPoolExecutor.CallerRunsPolicy() // Rejected tasks will run on calling thread.