Fix TimeKeeping Processor
@@ -60,13 +60,10 @@ public class BooleanTimekeeping implements EventProcessor<BooleanTimekeepingPara
boolean leftField = inputEvent.getFieldBySelector(leftFieldName).getAsPrimitive().getAsBoolean();
boolean rightField = inputEvent.getFieldBySelector(rightFieldName).getAsPrimitive().getAsBoolean();
- if (leftFieldLast == false && leftField == true) {
- this.allPending.push(System.currentTimeMillis());
- }
if (rightFieldLast == false && rightField == true) {
+ if (this.allPending.size() > 0) {
Long startTime = this.allPending.removeLast();
- if (startTime != null) {
Long timeDifference = System.currentTimeMillis() - startTime;
@@ -84,6 +81,11 @@ public class BooleanTimekeeping implements EventProcessor<BooleanTimekeepingPara
out.collect(inputEvent);
}
}
+
+
+ if (leftFieldLast == false && leftField == true) {
+ this.allPending.push(System.currentTimeMillis());
+ }
}
@Override
