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>
    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
    • 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.