Examples of AsyncLoopThread


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

Examples of com.alibaba.jstorm.callback.AsyncLoopThread

    // 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

Examples of com.alibaba.jstorm.callback.AsyncLoopThread

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

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

Examples of com.alipay.bluewhale.core.utils.AsyncLoopThread

        }
    }
   
    private AsyncLoopThread clearThread()
    {
       return  new AsyncLoopThread(new clearThreadcall());
    }
View Full Code Here

Examples of com.alipay.bluewhale.core.utils.AsyncLoopThread

    IConnection puller = mqContext.bind(topologyid, taskid);

    // ���������߳�
    TaskHeartbeatRunable hb = new TaskHeartbeatRunable(zkCluster, topologyid,
        taskid, uptime, taskStats, active, stormConf);
    AsyncLoopThread heartbeat_thread = new AsyncLoopThread(hb, true,
        Thread.MAX_PRIORITY, true);

    // ����tuple���ͺ�������ϵͳstream����startup��Ϣ
    List<Object> msg = new ArrayList<Object>();
    msg.add("startup");

    // ����task���ն���
    TaskSendTargets sendTargets = makeSendTargets();
    UnanchoredSend.send(topologyContext, sendTargets, workerTransfer,
        Common.SYSTEM_STREAM_ID, msg);

    // �����̣߳���zeroMq�ж�ȡtuple,����spout��bolt���д���Ȼ���͸�worker
    RunnableCallback componsementExecutor = mkExecutor(puller, sendTargets);
    AsyncLoopThread executor_threads = new AsyncLoopThread(
        componsementExecutor);
    AsyncLoopThread[] all_threads = { executor_threads, heartbeat_thread };

    LOG.info("Finished loading task " + componentid + ":" + taskid);
View Full Code Here

Examples of com.alipay.bluewhale.core.utils.AsyncLoopThread

    Map<Integer, Socket> virtual_mapping = new HashMap<Integer, ZMQ.Socket>();

    RunnableCallback loop_fn = new VirtualPortDispatch(context, socket,
        virtual_mapping, url, valid_ports);

    AsyncLoopThread vthread = new AsyncLoopThread(loop_fn, daemon, kill_fn,
        priority, true);

    return new VirtualPortShutdown(context, vthread, url);
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.utils.AsyncLoopThread

      }
    }

    //FIXME �����̳߳ز���
    // worker���������ĸ��߳�
    AsyncLoopThread refreshconn = new AsyncLoopThread(refreshConn);

    AsyncLoopThread refreshzk = new AsyncLoopThread(refreshZkActive);

    AsyncLoopThread hb = new AsyncLoopThread(heartbeat_fn, false, null,
        Thread.MAX_PRIORITY, true);

    AsyncLoopThread dr = new AsyncLoopThread(new DrainerRunable(transferQueue, nodeportSocket, taskNodeport));

    AsyncLoopThread[] threads = { refreshconn, refreshzk, hb, dr };


    return new WorkerShutdown(shutdowntasks, active, nodeportSocket,
View Full Code Here

Examples of com.alipay.bluewhale.core.utils.AsyncLoopThread

   
    //Step 9.1 start heartbeat thread
   
    //����һ���̣߳�ÿ��supervisor.heartbeat.frequency.secsд��һ��supervisor������Ϣ
    AsyncHeartbeat asyncHB = new AsyncHeartbeat(conf, hb, active);
    AsyncLoopThread heartbeat = new AsyncLoopThread(asyncHB, false, null,
        Thread.MAX_PRIORITY, true);
    threads.add(heartbeat);
   
    //Step 9.2 start sync Supervisor thread

    //����һ���̣߳�ÿ��10��ִ��SynchronizeSupervisor
    AsyncSynchronizeSupervisor syncSupervisor = new AsyncSynchronizeSupervisor(
        eventManager, synchronizeSupervisor, active);
    AsyncLoopThread syncsThread = new AsyncLoopThread(syncSupervisor);
    threads.add(syncsThread);


    // Step 9.3 start sync process thread

    //����һ���̣߳�ÿ��supervisor.monitor.frequency.secs��ִ��SyncProcesses
    AsyncSyncProcesses syncProcess = new AsyncSyncProcesses(conf,
        processesEventManager, syncProcesses, active);
    AsyncLoopThread syncpThread = new AsyncLoopThread(syncProcess, false,
        null, Thread.MAX_PRIORITY, true);
    threads.add(syncpThread);

    LOG.info("Starting supervisor with id " + supervisorId + " at host "
        + myHostName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.