T
- tuple typepublic class Deadtime<T> extends java.lang.Object implements Predicate<T>
Predicate
.
test()
returns true on its initial call
and then false for any calls occurring during the following deadtime period.
After the end of a deadtime period, the next call to test()
returns true and a new deadtime period is begun.
The deadtime period may be changed while the topology is running
via setPeriod(long, TimeUnit)
.
Filters.deadtime()
,
Serialized FormConstructor and Description |
---|
Deadtime()
Create a new Deadtime Predicate
|
Deadtime(long deadtimePeriod,
java.util.concurrent.TimeUnit unit)
Create a new Deadtime Predicate
|
Modifier and Type | Method and Description |
---|---|
void |
setPeriod(long deadtimePeriod,
java.util.concurrent.TimeUnit unit)
Set the deadtime period
|
boolean |
test(T value)
Test the deadtime predicate.
|
java.lang.String |
toString()
Returns a String for development/debug support.
|
public Deadtime()
Same as Deadtime(0, TimeUnit.SECONDS)
public Deadtime(long deadtimePeriod, java.util.concurrent.TimeUnit unit)
The first received tuple is always "accepted".
deadtimePeriod
- see setPeriod()
unit
- TimeUnit
of deadtimePeriod
public void setPeriod(long deadtimePeriod, java.util.concurrent.TimeUnit unit)
The end of a currently active deadtime period is shortened or extended to match the new deadtime period specification.
The deadtime period behavior is subject to the accuracy
of the system's System.currentTimeMillis()
.
A period of less than 1ms is equivalent to specifying 0.
deadtimePeriod
- the amount of time for test()
to return false after returning true.
Specify a value of 0 for no deadtime period.
Must be >= 0.unit
- TimeUnit
of deadtimePeriod
public boolean test(T value)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641