T
- the type of listenerpublic abstract class PollingScheduler<T> extends Object implements Runnable
This class is able to schedule a polling operation in the WuicScheduledThreadPool
.
Modifier and Type | Class and Description |
---|---|
class |
PollingScheduler.Polling
This class represents a polling information.
|
Constructor and Description |
---|
PollingScheduler()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Long |
getLastUpdateTimestampFor(String path)
Retrieves a timestamp that indicates the last time this nut has changed.
|
Map<T,? extends PollingScheduler.Polling> |
getNutObservers()
Gets polling data with observers.
|
int |
getPollingInterval()
Returns the polling interval.
|
void |
observe(String pattern,
T... listeners)
Adds a set of listeners to be notified when a polling operation is perform on a nut matching the given pattern.
|
void |
setPollingInterval(int intervalSeconds)
Defines a new polling interval.
|
public final void observe(String pattern, T... listeners) throws IOException
Adds a set of listeners to be notified when a polling operation is perform on a nut matching the given pattern.
pattern
- the pattern to use to retrieve the different real paths to polllisteners
- some listeners to be notified when an update has been detected on a nutIOException
- if an I/O occurs while retrieving last update of the nutpublic Map<T,? extends PollingScheduler.Polling> getNutObservers()
Gets polling data with observers.
public final int getPollingInterval()
Returns the polling interval.
public final void setPollingInterval(int intervalSeconds)
Defines a new polling interval. If current polling operation are currently processed, then they are not interrupted and a new scheduling is created if the given value is a positive number. If the value is not positive, then no polling will occur.
intervalSeconds
- interval in secondsprotected abstract Long getLastUpdateTimestampFor(String path) throws IOException
Retrieves a timestamp that indicates the last time this nut has changed.
path
- the real path of the nutIOException
- if any I/O error occursCopyright © 2012-2015. All Rights Reserved.