Package com.alibaba.jstorm.callback

Examples of com.alibaba.jstorm.callback.AsyncLoopThread


  private DisruptorQueue recvQueue;

  public ZMQRecvConnection(Socket _socket) {
    socket = _socket;
   
    new AsyncLoopThread(this, true,
        Thread.MAX_PRIORITY, true);
  }
View Full Code Here


    // every supervisor.heartbeat.frequency.secs, write SupervisorInfo to ZK
    // sync hearbeat to nimbus
    Heartbeat hb = new Heartbeat(conf, stormClusterState, supervisorId,
        active);
    hb.update();
    AsyncLoopThread heartbeat = new AsyncLoopThread(hb, false, null,
        Thread.MIN_PRIORITY, true);
    threads.add(heartbeat);
   
    // Sync heartbeat to Apsara Container
    AsyncLoopThread syncContainerHbThread = SyncContainerHb.mkSupervisorInstance(conf);
    if (syncContainerHbThread != null) {
        threads.add(syncContainerHbThread);
    }

    // Step 6 create and start sync Supervisor thread
    // every supervisor.monitor.frequency.secs second run SyncSupervisor
    EventManager processEventManager = new EventManagerImp(false);
    ConcurrentHashMap<String, String> workerThreadPids = new ConcurrentHashMap<String, String>();
    SyncProcessEvent syncProcessEvent = new SyncProcessEvent(supervisorId,
        conf, localState, workerThreadPids, sharedContext);

    EventManager syncSupEventManager = new EventManagerImp(false);
    SyncSupervisorEvent syncSupervisorEvent = new SyncSupervisorEvent(
        supervisorId, conf, processEventManager, syncSupEventManager,
        stormClusterState, localState, syncProcessEvent);

    int syncFrequence = JStormUtils.parseInt(conf
        .get(Config.SUPERVISOR_MONITOR_FREQUENCY_SECS));
    EventManagerPusher syncSupervisorPusher = new EventManagerPusher(
        syncSupEventManager, syncSupervisorEvent, active, syncFrequence);
    AsyncLoopThread syncSupervisorThread = new AsyncLoopThread(
        syncSupervisorPusher);
    threads.add(syncSupervisorThread);

    // Step 7 start sync process thread
    // every supervisor.monitor.frequency.secs run SyncProcesses
    // skip thread to do syncProcess, due to nimbus will check whether
    // worker is dead or not, if dead, it will reassign a new worker
    //
    // int syncProcessFrequence = syncFrequence/2;
    // EventManagerPusher syncProcessPusher = new EventManagerPusher(
    // processEventManager, syncProcessEvent, active,
    // syncProcessFrequence);
    // AsyncLoopThread syncProcessThread = new
    // AsyncLoopThread(syncProcessPusher);
    // threads.add(syncProcessThread);


    //Step 7 start httpserver
    int port = ConfigExtension.getSupervisorDeamonHttpserverPort(conf);
    Httpserver httpserver = new Httpserver(port, conf);
    httpserver.start();
   
    //Step 8 start uploading every 60 secs
    MetricSendClient client;
    if (ConfigExtension.isAlimonitorMetricsPost(conf)) {
      client = new AlimonitorClient(AlimonitorClient.DEFAUT_ADDR,
          AlimonitorClient.DEFAULT_PORT, true);
    } else {
        client = new MetricSendClient();
    }
    UploadSupervMetric uploadMetric = new UploadSupervMetric(conf, stormClusterState,
        supervisorId, active, 60, client);
    AsyncLoopThread uploadMetricThread = new AsyncLoopThread(uploadMetric);
    threads.add(uploadMetricThread);
   
    // SupervisorManger which can shutdown all supervisor and workers
    return new SupervisorManger(conf, supervisorId, active, threads,
        syncSupEventManager, processEventManager, httpserver,
View Full Code Here

    }).start();
    handlerServer.serve();
  }

  private void initClearThread() {
    clearThread = new AsyncLoopThread(new ClearThread(this));
    LOG.info("Successfully start clear thread");
  }
View Full Code Here

TOP

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

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.