Interface QueueingSegmentListener<K,V,E extends Event<K,V>>

All Superinterfaces:
io.reactivex.rxjava3.functions.Function<SegmentPublisherSupplier.Notification<CacheEntry<K,V>>,org.reactivestreams.Publisher<CacheEntry<K,V>>>

public interface QueueingSegmentListener<K,V,E extends Event<K,V>> extends io.reactivex.rxjava3.functions.Function<SegmentPublisherSupplier.Notification<CacheEntry<K,V>>,org.reactivestreams.Publisher<CacheEntry<K,V>>>
This interface describes methods needed for a segment listener that is used when iterating over the current events and be able to queue them properly
Since:
7.0
Author:
wburns
  • Field Details

    • NOTIFIED

      static final Object NOTIFIED
    • REMOVED

      static final Object REMOVED
  • Method Details

    • apply

      org.reactivestreams.Publisher<CacheEntry<K,V>> apply(SegmentPublisherSupplier.Notification<CacheEntry<K,V>> cacheEntryNotification) throws Throwable
      This should be invoked on a notification before actually processing the data. Note this method modifies the underlying listener state. It will return a Publisher with the entries that need to be notified or an empty Publisher if none
      Specified by:
      apply in interface io.reactivex.rxjava3.functions.Function<K,V>
      Parameters:
      cacheEntryNotification - The notification being processed
      Returns:
      a Publisher that returns all the CacheEntries that need to be notified
      Throws:
      Throwable
    • handleEvent

      boolean handleEvent(EventWrapper<K,V,E> wrapper, ListenerInvocation<Event<K,V>> invocation)
      This should be called by any listener when an event is generated to possibly queue it. If it is not queued, then the caller should take appropriate action such as manually firing the invocation.
      Parameters:
      wrapper - The event that was just raised
      invocation - The invocation the event would be fired on
      Returns:
      Whether or not it was queued. If it wasn't queued the invocation should be fired manually
    • transferComplete

      CompletionStage<Void> transferComplete()
      This is needed to tell the handler when the complete iteration is done. Depending on the implementation this could also fire all queued events that are remaining.