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

  • All Superinterfaces:
    BaseCacheStream.SegmentCompletionListener, java.util.function.Consumer<java.util.function.Supplier<java.util.PrimitiveIterator.OfInt>>

    public interface QueueingSegmentListener<K,​V,​E extends Event<K,​V>>
    extends BaseCacheStream.SegmentCompletionListener
    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 Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Object NOTIFIED  
      static java.lang.Object REMOVED  
    • Field Detail

      • NOTIFIED

        static final java.lang.Object NOTIFIED
      • REMOVED

        static final java.lang.Object REMOVED
    • Method Detail

      • markKeyAsProcessing

        java.lang.Object markKeyAsProcessing​(K key)
        This should be invoked on a key before actually processing the data. This way the handler knows to keep any newer events have come after the iteration.
        Parameters:
        key - The key being processed
        Returns:
        The previous value that was found to be updated, NOTIFIED if the key was previously marked as processing or REMOVED if the key was removed and this value shouldn't be processed
      • findCreatedEntries

        java.util.Set<CacheEntry<K,​V>> findCreatedEntries()
        This method is to be called just before marking the transfer as complete and after all keys have been manually processed. This will return all the entries that were raised in an event but not manually marked. This is indicative of a CREATE event occurring but not seeing the value.
        Returns:
      • notifiedKey

        void notifiedKey​(K key)
        This should invoked after the key has been successfully processed to tell the handler that the key is done.
        Parameters:
        key - The key that was processed
      • handleEvent

        boolean handleEvent​(EventWrapper<K,​V,​E> wrapper,
                            org.infinispan.notifications.impl.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

        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.