VALUE - public abstract class RecurrenceEventFilter<VALUE> extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_MAX_FREQUENCY |
static long |
DEFAULT_TEST_TIMEOUT
Deprecated.
|
static long |
DEFAULT_TIMEOUT
Deprecated.
|
static long |
TEST_MAX_FREQUENCY |
| Constructor and Description |
|---|
RecurrenceEventFilter()
Constructor creates a new
RecurrenceEventFilter instance pre-configured with the given DEFAULT_MAX_FREQUENCY. |
RecurrenceEventFilter(long maxFrequency)
Constructor creates a new
RecurrenceEventFilter instance pre-configured with the given maxFrequency. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Method cancels depending triggers which were not relayed yet.
|
VALUE |
getLastValue()
Deprecated.
please use
getLatestValue() instead. |
VALUE |
getLatestValue()
Method returns the latest triggered value.
|
boolean |
isTriggered()
Method returns if this instance was ever triggered since startup or since the last reset.
|
abstract void |
relay()
Method should be overwritten to get frequently informed about trigger actions.
|
void |
relay(VALUE value)
Method can be overwritten to get frequently informed about trigger actions and the related new value.
|
void |
reset()
Method cancels all depending triggers and resets the
triggered flag as well as resets the lastValue to null. |
void |
trigger()
This method triggers the relay if no trigger was relayed within the defined max frequency.
|
void |
trigger(boolean immediately)
This method triggers the relay if no trigger was relayed within the defined max frequency or the
immediately flag was set. |
void |
trigger(VALUE value)
This method triggers the relay if no trigger was relayed within the defined max frequency.
|
void |
trigger(VALUE value,
boolean immediately)
This method triggers the relay if no trigger was relayed within the defined max frequency or the
immediately flag was set. |
@Deprecated public static final long DEFAULT_TIMEOUT
public static final long DEFAULT_MAX_FREQUENCY
@Deprecated public static final long DEFAULT_TEST_TIMEOUT
public static final long TEST_MAX_FREQUENCY
public RecurrenceEventFilter()
RecurrenceEventFilter instance pre-configured with the given DEFAULT_MAX_FREQUENCY.public RecurrenceEventFilter(long maxFrequency)
RecurrenceEventFilter instance pre-configured with the given maxFrequency.maxFrequency - this is the maximum frequency in milliseconds where triggered events are relayed.public void trigger()
throws CouldNotPerformException
CouldNotPerformException - is thrown if the trigger could not be handled (e.g. because of a system shutdown).public void trigger(VALUE value) throws CouldNotPerformException
value - the new value which should be published via the next relay.CouldNotPerformException - is thrown if the trigger could not be handled (e.g. because of a system shutdown).public void trigger(boolean immediately)
throws CouldNotPerformException
immediately flag was set.
Note: Triggers are maybe filtered but the last trigger call will always result in a relay to guarantee the latest event will relayed.immediately - this flag forces the trigger to relay immediately without respect to the defined max frequency.CouldNotPerformException - is thrown if the trigger could not be handled (e.g. because of a system shutdown).public void trigger(VALUE value, boolean immediately) throws CouldNotPerformException
immediately flag was set.
Note: Triggers are maybe filtered but the last trigger call will always result in a relay to guarantee the latest value will relayed.value - the new value which should be published via the next relay.immediately - this flag forces the trigger to relay immediately without respect to the defined max frequency.CouldNotPerformException - is thrown if the trigger could not be handled (e.g. because of a system shutdown).public void cancel()
@Deprecated public VALUE getLastValue()
getLatestValue() instead.public VALUE getLatestValue() throws NotAvailableException
NotAvailableException - is thrown if a value was never triggered.public boolean isTriggered()
public void reset()
triggered flag as well as resets the lastValue to null.public void relay(VALUE value) throws Exception
relay() will not be called anymore.value - the latest value is passed via this argument.Exception - can be thrown during the relay. The exception will just be printed on the error channel.Copyright © 2015–2017 openbase.org. All rights reserved.