Search in sources :

Example 6 with Slice

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

the class DoTestLoadRuntimeSliceData method loadSlices.

public static void loadSlices(long range, String key, CacheManager cm) {
    long end = System.currentTimeMillis();
    long start = end - range * 1000;
    int cacheLen = cm.llen("store.region.uav", key);
    System.out.println("len:" + cacheLen);
    List<Slice> list = new ArrayList<>();
    for (int index = cacheLen - 1; index > 0; index--) {
        String sj = cm.lindex("store.region.uav", key, index);
        Slice r = new Slice(sj);
        if (r.getTime() <= end && r.getTime() >= start) {
            list.add(r);
            continue;
        }
        if (r.getTime() < start) {
            break;
        }
    }
    Collections.reverse(list);
    System.out.println("sellen:" + list.size());
    for (Slice slice : list) {
        System.out.println(JSONHelper.toString(slice));
    }
}
Also used : Slice(com.creditease.uav.feature.runtimenotify.Slice) ArrayList(java.util.ArrayList)

Aggregations

Slice (com.creditease.uav.feature.runtimenotify.Slice)6 ArrayList (java.util.ArrayList)3 NotificationEvent (com.creditease.agent.monitor.api.NotificationEvent)2 CacheManager (com.creditease.uav.cache.api.CacheManager)2 RuntimeNotifySliceMgr (com.creditease.uav.feature.runtimenotify.RuntimeNotifySliceMgr)2 StrategyJudgement (com.creditease.uav.feature.runtimenotify.StrategyJudgement)2 I1NQueueWorker (com.creditease.agent.spi.I1NQueueWorker)1 CacheLock (com.creditease.uav.cache.api.CacheManager.CacheLock)1 NotifyStrategy (com.creditease.uav.feature.runtimenotify.NotifyStrategy)1 RuntimeNotifyStrategyMgr (com.creditease.uav.feature.runtimenotify.scheduler.RuntimeNotifyStrategyMgr)1 JudgeNotifyTask (com.creditease.uav.feature.runtimenotify.task.JudgeNotifyTask)1 IOException (java.io.IOException)1 List (java.util.List)1 Map (java.util.Map)1