public class SourcePollerRunner extends Object implements Runnable
SourcePoller
to execute at a
configured rate, i.e., the polling interval.
This class maintains a list of all of the sources to be polled for their availability. Sources are added to this list when they come online and when they are deleted. A cached map is maintained of all the sources and their last availability states.
Constructor and Description |
---|
SourcePollerRunner()
Creates an empty list of
Source sources to be polled for availability. |
Modifier and Type | Method and Description |
---|---|
void |
bind(Source source)
Adds the
Source instance to the list and sets its current status to UNCHECKED,
indicating it will checked at the next polling interval. |
CachedSource |
getCachedSource(Source source)
Retrieves a
CachedSource which contains cached values from the specified Source . |
void |
run()
Checks the availability of each source in the list of sources to be polled.
|
void |
shutdown()
Calls the @link ExecutorService to shutdown immediately
|
void |
unbind(Source source)
Removes the
Source instance from the list of references so that its availability is no
longer polled. |
public SourcePollerRunner()
Source
sources to be polled for availability. This constructor
is invoked by the CatalogFramework's blueprint.public void run()
public void bind(Source source)
Source
instance to the list and sets its current status to UNCHECKED,
indicating it will checked at the next polling interval.source
- the source to add to the listpublic void unbind(Source source)
Source
instance from the list of references so that its availability is no
longer polled.source
- the source to remove from the listpublic CachedSource getCachedSource(Source source)
CachedSource
which contains cached values from the specified Source
. Returns a Source
with values from the last polling interval. If the Source
is not known, null is returned.source
- the source to get the CachedSource
forCachedSource
which contains cached valuespublic void shutdown()
This work is licensed under a Creative Commons Attribution 4.0 International License.