Interface QueueingSegmentListener<K,V,E extends Event<K,V>>
-
- All Superinterfaces:
BaseCacheStream.SegmentCompletionListener
,Consumer<Supplier<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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.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.Object
markKeyAsProcessing(K key)
This should be invoked on a key before actually processing the data.void
notifiedKey(K key)
This should invoked after the key has been successfully processed to tell the handler that the key is done.void
transferComplete()
This is needed to tell the handler when the complete iteration is done.-
Methods inherited from interface org.infinispan.BaseCacheStream.SegmentCompletionListener
accept, segmentCompleted
-
-
-
-
Method Detail
-
markKeyAsProcessing
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.
-
findCreatedEntries
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, 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 raisedinvocation
- 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.
-
-