/** * {@inheritDoc} * <p/> * Keeps events with future ts in the queue for processing in the next window. If the ts difference is more than the lag, stops scanning * the queue for the current window. */ @Override public Action evict(Event<T> event) { if (evictionContext == null) { //It is possible to get asked about eviction before we have a context, due to WindowManager.compactWindow. //In this case we should hold on to all the events. When the first watermark is received, the context will be set, //and the events will be reevaluated for eviction return Action.STOP; } long referenceTime = evictionContext.getReferenceTime(); long diff = referenceTime - event.getTimestamp(); if (diff < -lag) { return Action.STOP; } else if (diff < 0) { return Action.KEEP; } else { return super.evict(event); } }
/** * {@inheritDoc} * <p/> * Keeps events with future ts in the queue for processing in the next * window. If the ts difference is more than the lag, stops scanning * the queue for the current window. */ @Override public Action evict(Event<T> event) { if(evictionContext == null) { //It is possible to get asked about eviction before we have a context, due to WindowManager.compactWindow. //In this case we should hold on to all the events. When the first watermark is received, the context will be set, //and the events will be reevaluated for eviction return Action.STOP; } long referenceTime = evictionContext.getReferenceTime(); long diff = referenceTime - event.getTimestamp(); if (diff < -lag) { return Action.STOP; } else if (diff < 0) { return Action.KEEP; } else { return super.evict(event); } }