accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject accumulo git commit: ACCUMULO-4570 Use a boolean for active service instead of the ZooLock
Date Tue, 17 Jan 2017 21:57:08 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 07ef189c4 -> 6d8f41145


ACCUMULO-4570 Use a boolean for active service instead of the ZooLock

Closes #202


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

Branch: refs/heads/master
Commit: 6d8f4114526fe54fb8da4ee2a8669fe50785433b
Parents: 07ef189
Author: Josh Elser <elserj@apache.org>
Authored: Tue Jan 17 16:23:57 2017 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Tue Jan 17 16:54:43 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/master/Master.java  | 10 ++++++----
 .../main/java/org/apache/accumulo/monitor/Monitor.java    |  9 +++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/6d8f4114/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 0213ad5..b926b52 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -217,6 +217,8 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
   volatile SortedMap<TServerInstance,TabletServerStatus> tserverStatus = Collections.unmodifiableSortedMap(new
TreeMap<TServerInstance,TabletServerStatus>());
   final ServerBulkImportStatus bulkImportStatus = new ServerBulkImportStatus();
 
+  private final AtomicBoolean masterInitialized = new AtomicBoolean(false);
+
   @Override
   public synchronized MasterState getMasterState() {
     return state;
@@ -1302,6 +1304,9 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
       log.error("Failed to register replication metrics", e);
     }
 
+    // The master is fully initialized. Clients are allowed to connect now.
+    masterInitialized.set(true);
+
     while (clientService.isServing()) {
       sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
     }
@@ -1694,9 +1699,6 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
 
   @Override
   public boolean isActiveService() {
-    if (null != masterLock) {
-      return masterLock.isLocked();
-    }
-    return false;
+    return masterInitialized.get();
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6d8f4114/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 1e8feaa..d239a84 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -32,6 +32,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -119,6 +120,7 @@ public class Monitor implements HighlyAvailableService {
   private static long totalLookups = 0;
   private static int totalTables = 0;
   public static HighlyAvailableService HA_SERVICE_INSTANCE = null;
+  private static final AtomicBoolean monitorInitialized = new AtomicBoolean(false);
 
   private static class MaxList<T> extends LinkedList<Pair<Long,T>> {
     private static final long serialVersionUID = 1L;
@@ -545,6 +547,8 @@ public class Monitor implements HighlyAvailableService {
         }
       }
     }), "Scan scanner").start();
+
+    monitorInitialized.set(true);
   }
 
   public static class ScanStats {
@@ -845,9 +849,6 @@ public class Monitor implements HighlyAvailableService {
 
   @Override
   public boolean isActiveService() {
-    if (null != monitorLock && monitorLock.isLocked()) {
-      return true;
-    }
-    return false;
+    return monitorInitialized.get();
   }
 }


Mime
View raw message