use of edu.iu.dsc.tws.task.window.constant.Action in project twister2 by DSC-SPIDAL.
the class WindowManager method scanEvents.
public List<Event<T>> scanEvents(boolean fullScan) {
List<IMessage<T>> eventsToExpire = new ArrayList<>();
List<Event<T>> eventsToProcess = new ArrayList<>();
try {
lock.lock();
Iterator<Event<T>> it = queue.iterator();
while (it.hasNext()) {
Event<T> windowEvent = it.next();
Action action = evictionPolicy.evict(windowEvent);
if (action == Action.EXPIRE) {
eventsToExpire.add(windowEvent.get());
it.remove();
} else if (!fullScan || action == Action.STOP) {
break;
} else if (action == Action.PROCESS) {
eventsToProcess.add(windowEvent);
}
}
expiredEvents.addAll(eventsToExpire);
} finally {
lock.unlock();
}
eventsSinceLastExpiration.set(0);
if (!eventsToExpire.isEmpty()) {
if (debug) {
LOG.severe(String.format("OnExpiry called on WindowLifeCycleListener"));
}
IWindowMessage<T> eventsToExpireIWindow = bundleExpiredWindowIMessage(eventsToExpire);
windowLifeCycleListener.onExpiry(eventsToExpireIWindow);
}
return eventsToProcess;
}