/** Checks if the DFOs associated with logical node list are currently empty. */
  boolean areDFOsEmpty(Collection<LogicalNode> lns) {
    for (LogicalNode n : lns) {
      DiskFailoverManager dfo = FlumeNode.getInstance().getDFOManager(n.getName());

      if (!dfo.isEmpty()) return false;
    }
    return true;
  }
예제 #2
0
  @Deprecated
  public synchronized void getReports(Map<String, ReportEvent> reports) {
    String phyName = FlumeNode.getInstance().getPhysicalNodeName();
    String rprefix = phyName + "." + getName() + ".";

    if (snk != null) {
      snk.getReports(rprefix, reports);
    }
    if (src != null) {
      src.getReports(rprefix, reports);
    }
  }
예제 #3
0
  /**
   * 여기에 위치하는게 맞나?
   *
   * @throws IOException
   * @throws InterruptedException
   * @throws RuntimeException
   * @throws FlumeSpecException
   */
  public void recover()
      throws IOException, InterruptedException, RuntimeException, FlumeSpecException {
    LogicalNode logicalNode = FlumeNode.getInstance().getLogicalNodeManager().get(logicalNodeName);
    if (logicalNode == null) {
      log.error("Failed recover [" + logicalNodeName + "] is not registed in CheckpointManager");
      return;
    }
    log.info("Closing logicalNode[" + logicalNodeName + "]");
    logicalNode.close();
    log.info("Closed logicalNode[" + logicalNodeName + "]");

    log.info("Restarting LogicalNode [" + logicalNodeName + "]");
    logicalNode.restartNode();
    log.info("Finished LogicalNode [" + logicalNodeName + "]");
  }
예제 #4
0
  /** Creates a logical node that will accept any configuration */
  public LogicalNode(Context ctx, String name) {
    this.nodeName = name;
    this.ctx = ctx;

    // Note: version and lastSeen aren't kept up-to-date on the logical node.
    // The master fills them in when it receives a NodeStatus heartbeat.
    state =
        new NodeStatus(
            NodeState.HELLO,
            0,
            0,
            NetUtils.localhost(),
            FlumeNode.getInstance().getPhysicalNodeName());
    // Set version to -1 so that all non-negative versions will be 'later'
    lastGoodCfg =
        new FlumeConfigData(
            0,
            "null",
            "null",
            VERSION_INFIMUM,
            VERSION_INFIMUM,
            FlumeConfiguration.get().getDefaultFlowName());
  }
예제 #5
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write(
          "<!--\n Licensed to Cloudera, Inc. under one\n or more contributor license agreements.  See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership.  Cloudera, Inc. licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License.  You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n-->\n<html><head>\n<!-- Copyright (c) 2010 Cloudera, Inc.  All rights reserved. -->\n<!-- Retro web 1.0 flume Agent configuration display -->\n\n<title>Flume Node: ");
      out.print(FlumeNode.getInstance().getPhysicalNodeName());
      out.write(
          " :: Sources and Sinks</title>\n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/flume.css\" />\n\n</head>\n<body>\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "menu_agent.jsp", out, false);
      out.write("\n\n<h1>Flume Node: ");
      out.print(FlumeNode.getInstance().getPhysicalNodeName());
      out.write(" :: Extensions - Sink/Source/Decorator</h1>\n\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "version.jsp", out, false);
      out.write("\n<hr>\n\n\n<div id=\"sinks\">\n<h2>Sinks</h2>\n\n<table>\n\n");

      // treeset so that the list is sorted
      for (String n : new TreeSet<String>(FlumeBuilder.getSinkNames())) {

        out.write("\n    <tr><td>");
        out.print(n);
        out.write("</td></tr>\n");
      }

      out.write("\n\n</table>\n</div>\n\n<div id=\"sources\">\n<h2>Sources</h2>\n<table>\n\n");

      // treeset so that the list is sorted
      for (String n : new TreeSet<String>(FlumeBuilder.getSourceNames())) {

        out.write("\n    <tr><td>");
        out.print(n);
        out.write("</td></tr>\n");
      }

      out.write("\n\n</table>\n</div>\n\n<div id=\"decos\">\n<h2>Decorators</h2>\n<table>\n\n");

      // treeset so that the list is sorted
      for (String n : new TreeSet<String>(FlumeBuilder.getDecoratorNames())) {

        out.write("\n    <tr><td>");
        out.print(n);
        out.write("</td></tr>\n");
      }

      out.write("\n\n</table>\n</div>\n</body></html>\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
예제 #6
0
 @Override
 public void open() throws IOException, InterruptedException {
   FlumeNode.getInstance().getCheckPointManager().startServer(port);
   super.open();
 }
예제 #7
0
 @Override
 public void close() throws IOException, InterruptedException {
   FlumeNode.getInstance().getCheckPointManager().stopServer();
   super.close();
 }