Package com.alibaba.jstorm.callback

Examples of com.alibaba.jstorm.callback.RunnableCallback


  public void run() {
    LOG.debug("Synchronizing supervisor");

    try {

      RunnableCallback syncCallback = new EventManagerZkPusher(this,
          syncSupEventManager);

      /**
       * Step 1: get all assignments and register /ZK-dir/assignment and
       * every assignment watch
View Full Code Here


    TaskSendTargets sendTargets = echoToSystemBolt();

    // create thread to get tuple from zeroMQ,
    // and pass the tuple to bolt/spout
    RunnableCallback baseExecutor = mkExecutor(deserializeQueue, sendTargets);
    AsyncLoopThread executor_threads = new AsyncLoopThread(baseExecutor,
        false, Thread.MAX_PRIORITY, true);

    List<AsyncLoopThread> allThreads = new ArrayList<AsyncLoopThread>();
    allThreads.add(executor_threads);
View Full Code Here

    IConnection recvConnection = context.bind(topologyId,
        workerData.getPort());
    recvConnection.registerQueue(recvQueue);

    RunnableCallback recvDispather = new VirtualPortDispatch(workerData,
        recvConnection, recvQueue);

    AsyncLoopThread vthread = new AsyncLoopThread(recvDispather, false,
        Thread.MAX_PRIORITY, false);
View Full Code Here

    TaskHeartbeatRunable taskHB = new TaskHeartbeatRunable(workerData);
    AsyncLoopThread taskHBThread = new AsyncLoopThread(taskHB);
    threads.add(taskHBThread);

    // refresh hearbeat to Local dir
    RunnableCallback heartbeat_fn = new WorkerHeartbeatRunable(workerData);
    AsyncLoopThread hb = new AsyncLoopThread(heartbeat_fn, false, null,
        Thread.NORM_PRIORITY, true);
    threads.add(hb);

    // shutdown task callbacks
View Full Code Here

      data.getStormClusterState().register_nimbus_host(hostPort);
    } catch (Exception e) {
      LOG.error("register nimbus host fail!", e);
      throw new RuntimeException();
    }
    callback = new RunnableCallback() {
      @Override
      public void run() {
        if (!data.isLeader())
          check();
      }
View Full Code Here

    LOG.info("Finished downloading code for topology id " + topologyId
        + " from " + assignment.getMasterCodeDir());
  }

  private void tryToBeLeader(final Map conf) throws Exception {
    RunnableCallback masterCallback = new RunnableCallback() {
      @Override
      public void run() {
        try {
          tryToBeLeader(conf);
        } catch (Exception e) {
View Full Code Here

        List<String> toks = PathUtils.tokenize_path(path);
        int size = toks.size();
        if (size >= 1) {
          String params = null;
          String root = toks.get(0);
          RunnableCallback fn = null;
          if (root.equals(Cluster.ASSIGNMENTS_ROOT)) {
            if (size == 1) {
              // set null and get the old value
              fn = assignments_callback.getAndSet(null);
            } else {
              params = toks.get(1);
              fn = assignment_info_callback.remove(params);
            }

          } else if (root.equals(Cluster.SUPERVISORS_ROOT)) {
            fn = supervisors_callback.getAndSet(null);
          } else if (root.equals(Cluster.STORMS_ROOT) && size > 1) {
            params = toks.get(1);
            fn = storm_base_callback.remove(params);
          } else if (root.equals(Cluster.MASTER_ROOT)) {
            fn = master_callback.getAndSet(null);
          } else {
            LOG.error("Unknown callback for subtree " + path);
          }

          if (fn != null) {
            // FIXME How to set the args
            // fn.setArgs(params, zkEventTypes, path);
            fn.run();
          }
        }

        return null;
      }
View Full Code Here

  @Override
  public void run() {
    try {
      while (manager.isRunning()) {
        RunnableCallback r = null;
        try {
          r = manager.take();
        } catch (InterruptedException e) {
          // LOG.info("Failed to get ArgsRunable from EventManager queue");
        }

        if (r == null) {
          try {
            Thread.sleep(10);
          } catch (InterruptedException e) {

          }
          continue;
        }

        r.run();
        Exception e = r.error();
        if (e != null) {
          throw e;
        }
        manager.proccessinc();
View Full Code Here

  public boolean isRunning() {
    return isrunning.get();
  }

  public RunnableCallback poll() throws InterruptedException {
    RunnableCallback event = queue.poll();
    return event;
  }
View Full Code Here

    RunnableCallback event = queue.poll();
    return event;
  }
 
  public RunnableCallback take() throws InterruptedException {
    RunnableCallback event = queue.take();
    return event;
  }
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.callback.RunnableCallback

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.