accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [5/8] accumulo git commit: ACCUMULO-3837 merge to 1.7
Date Tue, 26 May 2015 15:53:10 GMT
ACCUMULO-3837 merge to 1.7


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

Branch: refs/heads/1.7
Commit: 9b1620c83ef4982f2748445333312404adbd3511
Parents: 81bd507 af8d3bf
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Tue May 26 11:36:09 2015 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Tue May 26 11:36:09 2015 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/monitor/Monitor.java    | 22 ++++++++++++++++++++
 .../accumulo/monitor/servlets/BasicServlet.java | 21 +------------------
 2 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9b1620c8/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --cc server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index ba977a7,0113fb6..800fce2
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@@ -29,6 -29,9 +29,8 @@@ import java.util.List
  import java.util.Map;
  import java.util.Map.Entry;
  import java.util.Set;
+ import java.util.TimerTask;
 -import java.util.TreeMap;
+ import java.util.concurrent.atomic.AtomicReference;
  
  import org.apache.accumulo.core.Constants;
  import org.apache.accumulo.core.client.Connector;
@@@ -85,13 -84,15 +87,14 @@@ import org.apache.accumulo.server.monit
  import org.apache.accumulo.server.problems.ProblemReports;
  import org.apache.accumulo.server.problems.ProblemType;
  import org.apache.accumulo.server.security.SecurityUtil;
 -import org.apache.accumulo.server.security.SystemCredentials;
  import org.apache.accumulo.server.util.Halt;
  import org.apache.accumulo.server.util.TableInfoUtil;
+ import org.apache.accumulo.server.util.time.SimpleTimer;
  import org.apache.accumulo.server.zookeeper.ZooLock;
  import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 -import org.apache.accumulo.trace.instrument.Tracer;
 -import org.apache.log4j.Logger;
  import org.apache.zookeeper.KeeperException;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
  
  import com.google.common.net.HostAndPort;
  
@@@ -240,6 -248,22 +246,22 @@@ public class Monitor 
        return;
  
      synchronized (Monitor.class) {
+       // Learn our instance name asynchronously so we don't hang up if zookeeper is down
+       if (cachedInstanceName.get().equals(DEFAULT_INSTANCE_NAME)) {
 -        SimpleTimer.getInstance().schedule(new TimerTask() {
++        SimpleTimer.getInstance(config.getConfiguration()).schedule(new TimerTask() {
+           @Override
+           public void run() {
+             synchronized (Monitor.class) {
+               if (cachedInstanceName.get().equals(DEFAULT_INSTANCE_NAME)) {
+                 cachedInstanceName.set(HdfsZooInstance.getInstance().getInstanceName());
+               }
+             }
+           }
+         }, 0);
+       }
+     }
+ 
+     synchronized (Monitor.class) {
        if (fetching)
          return;
        fetching = true;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9b1620c8/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
----------------------------------------------------------------------
diff --cc server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
index 43ab121,f39fe4d..fac18cd
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
@@@ -38,9 -36,9 +36,8 @@@ import javax.servlet.http.HttpServletRe
  import org.apache.accumulo.core.Constants;
  import org.apache.accumulo.core.conf.Property;
  import org.apache.accumulo.monitor.Monitor;
 -import org.apache.accumulo.server.client.HdfsZooInstance;
  import org.apache.accumulo.server.monitor.DedupedLogEvent;
  import org.apache.accumulo.server.monitor.LogService;
- import org.apache.accumulo.server.util.time.SimpleTimer;
  import org.apache.log4j.Level;
  import org.apache.log4j.Logger;
  
@@@ -48,10 -46,9 +45,9 @@@ abstract public class BasicServlet exte
  
    private static final long serialVersionUID = 1L;
    protected static final Logger log = Logger.getLogger(BasicServlet.class);
-   static AtomicReference<String> cachedInstanceName = new AtomicReference<String>("(Unavailable)");
 -  private static String bannerText;
 -  private static String bannerColor;
 -  private static String bannerBackground;
 +  private String bannerText;
 +  private String bannerColor;
 +  private String bannerBackground;
  
    abstract protected String getTitle(HttpServletRequest req);
  
@@@ -173,9 -155,9 +154,9 @@@
      }
      sb.append("<div id='headertitle'>");
      sb.append("<h1>").append(getTitle(req)).append("</h1></div>\n");
-     sb.append("<div id='subheader'>Instance&nbsp;Name:&nbsp;").append(cachedInstanceName.get()).append("&nbsp;&nbsp;&nbsp;Version:&nbsp;")
 -    sb.append("<div id='subheader'>Instance&nbsp;Name:&nbsp;").append(Monitor.cachedInstanceName.get()).append("&nbsp;&nbsp;&nbsp;Version:&nbsp;").append(Constants.VERSION)
 -        .append("\n");
 -    sb.append("<br><span class='smalltext'>Instance&nbsp;ID:&nbsp;").append(HdfsZooInstance.getInstance().getInstanceID()).append("</span>\n");
++    sb.append("<div id='subheader'>Instance&nbsp;Name:&nbsp;").append(Monitor.cachedInstanceName.get()).append("&nbsp;&nbsp;&nbsp;Version:&nbsp;")
 +        .append(Constants.VERSION).append("\n");
 +    sb.append("<br><span class='smalltext'>Instance&nbsp;ID:&nbsp;").append(Monitor.getContext().getInstance().getInstanceID()).append("</span>\n");
      sb.append("<br><span class='smalltext'>").append(new Date().toString().replace("
", "&nbsp;")).append("</span>");
      sb.append("</div>\n"); // end <div id='subheader'>
      sb.append("</div>\n"); // end <div id='header'>


Mime
View raw message