Package com.cloudera.flume.master

Examples of com.cloudera.flume.master.Command


  /**
   * Convert this bean into a command.
   */
  public Command toCommand() {
    String[] args = { physicalNode, logicalNode };
    return new Command("unmap", args);
  }
View Full Code Here


  /**
   * Convert this bean into a command.
   */
  public Command toCommand() {
    String[] args = { physicalNode, logicalNode };
    return new Command("spawn", args);
  }
View Full Code Here

public class UpdateAllCommand {
  /**
   * Build a command for the command manager.
   */
  public Command toCommand() {
    return new Command("updateAll");
  }
View Full Code Here

public class RefreshAllCommand {
  /**
   * Build a command for the command manager.
   */
  public Command toCommand() {
    return new Command("refreshAll");
  }
View Full Code Here

  /**
   * Build a command for the command manager.
   */
  public Command toCommand() {
    return new Command("purge", node);
  }
View Full Code Here

  /**
   * Convert this bean into a command.
   */
  public Command toCommand() {
    String[] args = { "physicalnode", "chokeID", "limit" };
    return new Command("setChokeLimit", args);
  }
View Full Code Here

  /**
   * Build a command for the command manager.
   */
  public Command toCommand() {
    return new Command("unconfig", node);
  }
View Full Code Here

  /**
   * Convert this bean into a command.
   */
  public Command toCommand() {
    String[] args = { logicalNode };
    return new Command("decommission", args);
  }
View Full Code Here

      try {
        List<String> args = new ArrayList<String>();
        if (cmd.getArgs().size() > 1) {
          args = cmd.getArgs().subList(1, cmd.getArgs().size());
        }
        long cmdid = client.submit(new Command(cmd.getArgs().get(0),
            (String[]) args.toArray(new String[args.size()])));
        lastCmdId = cmdid;
        // Do not change this, other programs will likely depend on this.
        System.out.println("[id: " + cmdid + "] Submitted command : "
            + cmd.getArgs().get(0));
        return cmdid;
      } catch (IOException e) {
        disconnect();
        LOG.debug("config failed due to transport error", e);
        return -1;
      }
    }

    /*
     * Wait waits for the specified cmdid to be done (success or error), for a
     * specified amount of time. If no cmdid is specified, it is assumed to be
     * the last command issued by the shell, or the last command in the master's
     * command queue.
     *
     * 0 wait time means forever.
     */
    if (cmd.getCommand().equals("wait")) {
      long millis = CMD_WAIT_TIME_MS;
      long cmdid = lastCmdId;

      // args are time, and then cmdid.
      List<String> args = cmd.getArgs();
      if (args.size() >= 1) {
        long ms = Long.parseLong(args.get(0));
        if (ms < 0) {
          System.out.println("Wait time <0 is illegal");
          return -1;
        }
        // if 0, effectively wait forever.
        millis = (ms == 0) ? Long.MAX_VALUE : ms;
      }

      if (args.size() >= 2) {
        cmdid = Long.parseLong(args.get(1));
      }

      try {
        return pollWait(cmdid, millis);
      } catch (IOException e) {
        disconnect();
        LOG.debug("config failed due to transport error", e);
        return -1;
      } catch (InterruptedException e) {
        System.out.println("Interrupted during command processing");
        LOG.debug("Interrupted!", e);
        return -1;
      }
    }

    /*
     * Exec sends a command to the master and polls for a response. These are
     * the commands which cause the master to do some processing. We wait
     * synchronously for success or failure.
     *
     * There is no schema checking for these commands - so it is possible to
     * send ill-formed commands and receive a failure notification with no idea
     * of what went wrong.
     */
    if (cmd.getCommand().equals("exec")) {
      try {
        List<String> args = new ArrayList<String>();
        if (cmd.getArgs().size() > 1) {
          args = cmd.getArgs().subList(1, cmd.getArgs().size());
        }
        long cmdid = client.submit(new Command(cmd.getArgs().get(0),
            (String[]) args.toArray(new String[args.size()])));
        System.out.println("[id: " + cmdid + "] Execing command : "
            + cmd.getArgs().get(0));
        lastCmdId = cmdid;

View Full Code Here

public class PurgeAllCommand {
  /**
   * Build a command for the command manager.
   */
  public Command toCommand() {
    return new Command("purgeAll");
  }
View Full Code Here

TOP

Related Classes of com.cloudera.flume.master.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.