Interface SharedPollingSource<T extends Event>
- Type Parameters:
T- The type of events this event source creates.
- All Superinterfaces:
EventSource<T>,PollingSource<T>,Runnable
- All Known Implementing Classes:
AbstractSharedEventSource
A
SharedPollingSource unifies the polling for several
SharingSource-instances. It checks for whether they can be
combined, usually by checking several of their configuration values, and
polls combined. Each polling can concern several shared sources. Therefore
the polling result is split appropriately (it may also be provided as one),
the affected sharing sources are determined and notified via
EventHandler.- Author:
- Ulrich Kreher
-
Field Summary
Fields inherited from interface de.aristaflow.adept2.model.events.sources.PollingSource
CONF_POLL_TIME, CONF_START_TIME -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddSharingSource(SharingSource<?> source) Adds the designated sharing source at this shared source.booleanremoveSharingSource(SharingSource<?> source) Removes the designated sharing source from this shared source.booleansupportsSharingSource(SharingSource<?> source) Gets whether this shared source can handle the designated sharing source and combine it with the already registered sharing sources.Methods inherited from interface de.aristaflow.adept2.model.events.sources.EventSource
addAll, addHandler, getEventHandler, getHierarchicalSourceName, getID, getType, removeHandler, setConfigurationMethods inherited from interface de.aristaflow.adept2.model.events.sources.PollingSource
getPollTime, getStartTime, init, terminate
-
Method Details
-
supportsSharingSource
Gets whether this shared source can handle the designated sharing source and combine it with the already registered sharing sources. This usually analyses some of the configuration values of the designated sharing source.- Parameters:
source- The source that wants to share a source for polling.- Returns:
- Whether this shared source can handle the designated sharing source and combine it with the already registered sharing sources.
-
addSharingSource
Adds the designated sharing source at this shared source. This will add it to the existing sharing sources by combining the poll for the events.
Implementations should usually also add the designated sharing source as event handler. Callers do not register the sharing source as event handler separately.- Parameters:
source- The source that wants to share a source for polling.- Returns:
- Whether the designated sharing sources has been successfully added.
This is quite similar to the return value of
supportsSharingSource(SharingSource).
-
removeSharingSource
Removes the designated sharing source from this shared source. This will remove it from the existing sharing sources. Afterwards no polling for the designated sharing source will occur.
Implementations should usually also remove the designated sharing source as event handler. Callers do not unregister the sharing source as event handler separately.- Parameters:
source- The source that does no longer want to share a source for polling.- Returns:
- Whether the last sharing source has been removed. In this case this shared polling source should also be removed from polling.
-