Search in sources :

Example 1 with JudgeNotifyTask

use of com.creditease.uav.feature.runtimenotify.task.JudgeNotifyTask in project uavstack by uavorg.

the class RuntimeNotifyCatcher method pushToSliceQueue.

private void pushToSliceQueue(MonitorDataFrame mdf, boolean needConcurrent) {
    long now = System.currentTimeMillis();
    if (now - mdf.getTimeFlag() > DROP_TIMEOUT) {
        if (log.isDebugEnable()) {
            log.debug(this, "MDF too late, drop it: " + mdf.toJSONString());
        }
        return;
    }
    // step 1: store slices
    List<Slice> slices = extractSlice(mdf);
    RuntimeNotifySliceMgr rnsm = (RuntimeNotifySliceMgr) ConfigurationManager.getInstance().getComponent(this.feature, "RuntimeNotifySliceMgr");
    rnsm.storeSlices(slices, mdf.getTag());
    if (log.isDebugEnable()) {
        log.debug(this, "Prepare Slices for Judge: count= " + slices.size());
    }
    // step 2: notification judge
    if (needConcurrent == false) {
        // one thread judge
        for (Slice slice : slices) {
            new JudgeNotifyTask(JudgeNotifyTask.class.getSimpleName(), "runtimenotify", slice).run();
        }
    } else {
        // 1+N Queue Judge
        I1NQueueWorker n1nqw = get1NQueueWorkerMgr().getQueueWorker(this.feature, RuntimeNotifyCatcher.QWORKER_NAME);
        for (Slice slice : slices) {
            n1nqw.put(new JudgeNotifyTask(JudgeNotifyTask.class.getSimpleName(), feature, slice));
        }
    }
}
Also used : Slice(com.creditease.uav.feature.runtimenotify.Slice) JudgeNotifyTask(com.creditease.uav.feature.runtimenotify.task.JudgeNotifyTask) RuntimeNotifySliceMgr(com.creditease.uav.feature.runtimenotify.RuntimeNotifySliceMgr) I1NQueueWorker(com.creditease.agent.spi.I1NQueueWorker)

Aggregations

I1NQueueWorker (com.creditease.agent.spi.I1NQueueWorker)1 RuntimeNotifySliceMgr (com.creditease.uav.feature.runtimenotify.RuntimeNotifySliceMgr)1 Slice (com.creditease.uav.feature.runtimenotify.Slice)1 JudgeNotifyTask (com.creditease.uav.feature.runtimenotify.task.JudgeNotifyTask)1