当前位置: 首页>>代码示例>>Java>>正文


Java RemoveEvent类代码示例

本文整理汇总了Java中org.wso2.siddhi.core.event.remove.RemoveEvent的典型用法代码示例。如果您正苦于以下问题:Java RemoveEvent类的具体用法?Java RemoveEvent怎么用?Java RemoveEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoveEvent类属于org.wso2.siddhi.core.event.remove包,在下文中一共展示了RemoveEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
public void processEvent(InListEvent listEvent) {
    acquireLock();
    try {
        if (!async && siddhiContext.isDistributedProcessingEnabled()) {
            long expireTime = System.currentTimeMillis() + timeToKeep;
            for (int i = 0, activeEvents = listEvent.getActiveEvents(); i < activeEvents; i++) {
                window.put(new RemoveEvent(listEvent.getEvent(i), expireTime));
            }
        } else {
            window.put(new RemoveListEvent(EventConverter.toRemoveEventArray(listEvent.getEvents(), listEvent.getActiveEvents(), System.currentTimeMillis() + timeToKeep)));
        }
        nextProcessor.process(listEvent);
    } finally {
        releaseLock();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:18,代码来源:TimeWindowProcessor.java

示例2: init

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void init(Expression[] parameters, QueryPostProcessingElement nextProcessor, AbstractDefinition streamDefinition, String elementId, boolean async, SiddhiContext siddhiContext) {
    if (parameters[0] instanceof IntConstant) {
        timeToKeep = ((IntConstant) parameters[0]).getValue();
    } else {
        timeToKeep = ((LongConstant) parameters[0]).getValue();
    }

    oldEventList = new ArrayList<RemoveEvent>();
    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        newEventList = this.siddhiContext.getHazelcastInstance().getList(elementId + "-newEventList");
    } else {
        newEventList = new ArrayList<InEvent>();
    }

    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        window = new SchedulerSiddhiQueueGrid<StreamEvent>(elementId, this, this.siddhiContext, this.async);
    } else {
        window = new SchedulerSiddhiQueue<StreamEvent>(this);
    }
    //Ordinary scheduling
    window.schedule();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:TimeBatchWindowProcessor.java

示例3: init

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void init(Expression[] parameters, QueryPostProcessingElement nextProcessor, AbstractDefinition streamDefinition, String elementId, boolean async, SiddhiContext siddhiContext) {
    lengthToKeep = ((IntConstant) parameters[0]).getValue();

    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        window = new SiddhiQueueGrid<StreamEvent>(elementId, this.siddhiContext, this.async);
    } else {
        window = new SiddhiQueue<StreamEvent>();
    }
    oldEventList = new ArrayList<RemoveEvent>();
    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        newEventList = this.siddhiContext.getHazelcastInstance().getList(elementId + "-newEventList");
    } else {
        newEventList = new ArrayList<InEvent>();
    }

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:18,代码来源:LengthBatchWindowProcessor.java

示例4: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
public void processEvent(InListEvent listEvent) {
    acquireLock();
    try {
        long currentTime = (Long) listEvent.getEvent(listEvent.getActiveEvents() - 1).getData(timeStampAttributePosition);
        removeExpiredEvent(currentTime);
        long expireTime = currentTime + timeToKeep;
        if (!async && siddhiContext.isDistributedProcessingEnabled()) {
            for (int i = 0, activeEvents = listEvent.getActiveEvents(); i < activeEvents; i++) {
                window.put(new RemoveEvent(listEvent.getEvent(i), expireTime));
            }
        } else {
            window.put(new RemoveListEvent(EventConverter.toRemoveEventArray(listEvent.getEvents(), listEvent.getActiveEvents(), expireTime)));
        }
        nextProcessor.process(listEvent);
    } finally {
        releaseLock();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:20,代码来源:ExternalTimeWindowProcessor.java

示例5: add

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
public void add(StreamEvent item) {
    if (item instanceof AtomicEvent) {
        if (cacheList.size() >= limit) {
            cacheList.remove(0);
        }
        cacheList.add(new RemoveEvent((Event) item, Long.MAX_VALUE));
    } else {
        for (int i = 0, size = ((ListEvent) item).getActiveEvents(); i < size; i++) {
            if (cacheList.size() >= limit) {
                cacheList.remove(0);
            }
            cacheList.add(new RemoveEvent(((ListEvent) item).getEvent(i), Long.MAX_VALUE));
        }
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:17,代码来源:BasicCacheManager.java

示例6: put

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
/**
 * Every event that expires before next polling time will be put into a single group.
 * If an event receives which expires after the next polling time, a new group will be
 * created and subsequent messages will be put into that group and update next polling
 * time. In this way separate groups will be created for messages which expires before
 * a particular polling time. And since this is a FIFO queue the group that has to be
 * pop-ed out in the next pol will always at the peek of the queue
 * @param streamEvent
 */
@Override
public synchronized void put(T streamEvent) {
   long expiryTime = ((RemoveEvent)streamEvent).getExpiryTime();

    if (!pairQueue.isEmpty() && nextPollTime >= expiryTime) {
        lastPair.getTwo().add(streamEvent);
    } else {
        LinkedBlockingQueue<T> eventsList = new LinkedBlockingQueue<T>();
        eventsList.add(streamEvent);
        Pair<Long, LinkedBlockingQueue<T>> eventPair = new Pair<Long, LinkedBlockingQueue<T>>(nextPollTime, eventsList);
        pairQueue.add(eventPair);
        lastPair = eventPair;

        updateNextPollTime(nextPollTime);
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:TimeStampSiddhiQueue.java

示例7: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void processEvent(StreamEvent event) {
    acquireLock();
    try {
        RemoveEvent removeEvent = new RemoveEvent(event,System.currentTimeMillis());
        removeEvent.setOnAfterWindowData(((InnerStreamEvent)event).getOnAfterWindowData());
        window.add(removeEvent);
        if (window.size() > lengthToKeep) {
            next.process(window.remove(0));
        }
        next.process(event);
    } finally {
        releaseLock();
    }

}
 
开发者ID:sacjaya,项目名称:siddhi-3,代码行数:17,代码来源:LengthWindowProcessor.java

示例8: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        window.put(new RemoveEvent(event, Long.MAX_VALUE));
        if (window.size() > lengthToKeep) {
            nextProcessor.process((Event) window.poll());
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:15,代码来源:LengthWindowProcessor.java

示例9: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        sortedWindow.add(new RemoveEvent(event, Long.MAX_VALUE));
        if (sortedWindow.size() > lengthToKeep) {
            Collections.sort(sortedWindow, eventComparator);
            nextProcessor.process(new RemoveEvent(sortedWindow.remove(sortedWindow.size()-1), System.currentTimeMillis()));
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:16,代码来源:SortWindowProcessor.java

示例10: restoreState

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void restoreState(Object[] data) {
    window.restoreState((Object[]) data[0]);
    oldEventList = ((ArrayList<RemoveEvent>) data[1]);
    newEventList = ((ArrayList<InEvent>) data[2]);
    window.reSchedule();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:8,代码来源:TimeBatchWindowProcessor.java

示例11: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        StreamEvent oldEvent = map.put(generateKey(event), new RemoveEvent(event, Long.MAX_VALUE));
        if (oldEvent != null) {
            nextProcessor.process((AtomicEvent) oldEvent);
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:14,代码来源:UniqueWindowProcessor.java

示例12: processLengthBatchWindow

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
private void processLengthBatchWindow(InEvent event) {
    newEventList.add(event);
    if (log.isDebugEnabled()) {
        log.debug("newEventList size " + newEventList.size() + " with event " + event);
    }
    if (newEventList.size() == lengthToKeep) {

        //sending old events
        oldEventList.clear();
        while (true) {
            RemoveEvent oldEvent = (RemoveEvent) window.poll();
            if (oldEvent == null) {
                break;
            } else {
                oldEvent.setExpiryTime(System.currentTimeMillis());
                oldEventList.add(oldEvent);
            }
        }
        if (oldEventList.size() > 0) {
            nextProcessor.process(new RemoveListEvent(oldEventList.toArray(new RemoveEvent[oldEventList.size()])));
            oldEventList.clear();
        }

        InEvent[] inEvents = newEventList.toArray(new InEvent[newEventList.size()]);
        for (InEvent inEvent : inEvents) {
            window.put(new RemoveEvent(inEvent, -1));
        }
        nextProcessor.process(new InListEvent(inEvents));

        newEventList.clear();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:33,代码来源:LengthBatchWindowProcessor.java

示例13: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        StreamEvent oldEvent = map.putIfAbsent(generateKey(event), new RemoveEvent(event, Long.MAX_VALUE));
        if (oldEvent == null) {
            nextProcessor.process(event);
        }
    } finally {
        releaseLock();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:13,代码来源:FirstUniqueWindowProcessor.java

示例14: removeExpiredEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
private void removeExpiredEvent(long currentTime) {
    while (true) {
        RemoveEvent expiredEvent = (RemoveEvent) window.peek();
        if (expiredEvent != null && expiredEvent.getExpiryTime() < currentTime) {
            nextProcessor.process((AtomicEvent) window.poll());
        } else {
            break;
        }
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:11,代码来源:ExternalTimeWindowProcessor.java

示例15: toString

import org.wso2.siddhi.core.event.remove.RemoveEvent; //导入依赖的package包/类
@Override
public String toString() {
    return "Event{" +
            "streamId='" + streamId + '\'' +
            ", timeStamp=" + timeStamp +
            ", data=" + (data == null ? null : Arrays.asList(data)) +
            ", type=" + ((this instanceof InStream) ? "new" : ((this instanceof RemoveEvent) ? "remove" : "other"))+
            '}';
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:10,代码来源:Event.java


注:本文中的org.wso2.siddhi.core.event.remove.RemoveEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。