Interface IDProviderEventAgent


public interface IDProviderEventAgent
An event agent providing means for IDProvider based change events.
Since:
5.2.210505
  • Field Details

  • Method Details

    • addListener

      boolean addListener(@NotNull @NotNull Predicate<EventInfo> filter, @NotNull @NotNull Consumer<RevisionEvent> listener)
      Adds a StoreElement event listener that will receive only Predicate.test(Object) accepted} events.
      The listener reference will be held weakly, so you have to keep a reference to the listener instance or it will be automatically collected by the GC and de-registered from this agent.
      If the filter or listener are implementing Closeable, their close() method will be called, if the underlying Connection is closed. A closed Connection no longer delivers any events to a listener.
      Note: Remember to invoke removeListener(Consumer) if the listener is no longer needed.
      Parameters:
      filter - A filter that specifies, which events will be accepted and witch won't. The filtering is based on a lightweight EventInfo object and has to return fast. Filtering out as many events as possible prevents the creation of unnecessary heavyweight RevisionEvent objects. The filter may be called more than once for one revision event, for each change operation being part of the event. If any of the calls is accepted, the revision event object gets handed to the listener afterwards.
      listener - The listener to receive accepted events. The event handling is executed in a separate worker thread and does not block event processing of other listeners.
      Returns:
      Returns true if the listener and filter were added, returns false if the listener and filter combination were already present and not added.
      Since:
      5.2.210505
    • removeListener

      boolean removeListener(@NotNull @NotNull Consumer<RevisionEvent> listener)
      Removes a previously registered event listener.
      Parameters:
      listener - The registered event listener.
      Returns:
      Returns true if the listener was removed, returns false if the listener was not registered and therefore not removed.
      Since:
      5.2.210505