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
public interface SharedPollingSource<T extends Event> extends PollingSource<T>
ASharedPollingSource
unifies the polling for severalSharingSource
-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 viaEventHandler
.- Author:
- Ulrich Kreher
-
-
Field Summary
-
Fields inherited from interface de.aristaflow.adept2.model.events.sources.PollingSource
CONF_POLL_TIME, CONF_START_TIME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addSharingSource(SharingSource<?> source)
Adds the designated sharing source at this shared source.boolean
removeSharingSource(SharingSource<?> source)
Removes the designated sharing source from this shared source.boolean
supportsSharingSource(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, setConfiguration
-
Methods inherited from interface de.aristaflow.adept2.model.events.sources.PollingSource
getPollTime, getStartTime, init, terminate
-
-
-
-
Method Detail
-
supportsSharingSource
boolean supportsSharingSource(SharingSource<?> source)
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
boolean addSharingSource(SharingSource<?> source)
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
boolean removeSharingSource(SharingSource<?> source)
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.
-
-