public class LastEventOperator extends Object
class MyPunchlet extends Punchlet {
LastEventOperator lastEvent = new LastEventOperator();;
public void execute(Tuple root) {
...
if (!lastEvent.markedSince(TimeUnit.SECONDS, 5)) {
// the last 'mark' did not occur in the last 5 seconds
// you may want to do something ...
}
...
{
lastEvent.mark();
}
}
}
| Constructor and Description |
|---|
LastEventOperator()
Create a new operator
|
| Modifier and Type | Method and Description |
|---|---|
void |
mark()
Signal the occurrence of an event.
|
boolean |
markedSince(TimeUnit unit,
long value)
Check if the last event was marked occurred in given interval
|
public void mark()
public boolean markedSince(TimeUnit unit, long value)
unit - the time unit used to format the value parametervalue - the time interval, expressed according to the TimeUnit parameterCopyright © 2023. All rights reserved.