accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/9] accumulo git commit: ACCUMULO-3875 Remove unnecessary synchronization and conditional.
Date Sun, 31 May 2015 20:13:04 GMT
ACCUMULO-3875 Remove unnecessary synchronization and conditional.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e7f93b68
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e7f93b68
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e7f93b68

Branch: refs/heads/1.7
Commit: e7f93b685c8686c8107f7da833f5d20ed5242722
Parents: 76c545b
Author: Josh Elser <elserj@apache.org>
Authored: Sun May 31 14:26:58 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Sun May 31 16:12:23 2015 -0400

----------------------------------------------------------------------
 .../impl/MiniAccumuloClusterControl.java        | 31 +++++++++-----------
 1 file changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e7f93b68/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
index c2faf81..fee0016 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java
@@ -20,7 +20,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
@@ -56,7 +55,7 @@ public class MiniAccumuloClusterControl implements ClusterControl {
   Process gcProcess = null;
   Process monitor = null;
   Process tracer = null;
-  List<Process> tabletServerProcesses = Collections.synchronizedList(new ArrayList<Process>());
+  final List<Process> tabletServerProcesses = new ArrayList<Process>();
 
   public MiniAccumuloClusterControl(MiniAccumuloClusterImpl cluster) {
     Preconditions.checkNotNull(cluster);
@@ -228,23 +227,21 @@ public class MiniAccumuloClusterControl implements ClusterControl {
         }
         break;
       case TABLET_SERVER:
-        if (tabletServerProcesses != null) {
-          synchronized (tabletServerProcesses) {
-            try {
-              for (Process tserver : tabletServerProcesses) {
-                try {
-                  cluster.stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
-                } catch (ExecutionException e) {
-                  log.warn("TabletServer did not fully stop after 30 seconds", e);
-                } catch (TimeoutException e) {
-                  log.warn("TabletServer did not fully stop after 30 seconds", e);
-                } catch (InterruptedException e) {
-                  Thread.currentThread().interrupt();
-                }
+        synchronized (tabletServerProcesses) {
+          try {
+            for (Process tserver : tabletServerProcesses) {
+              try {
+                cluster.stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
+              } catch (ExecutionException e) {
+                log.warn("TabletServer did not fully stop after 30 seconds", e);
+              } catch (TimeoutException e) {
+                log.warn("TabletServer did not fully stop after 30 seconds", e);
+              } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
               }
-            } finally {
-              tabletServerProcesses.clear();
             }
+          } finally {
+            tabletServerProcesses.clear();
           }
         }
         break;


Mime
View raw message