Interface QueueingSegmentListener<K,V,E extends Event<K,V>>
-
- All Superinterfaces:
IntConsumer
public interface QueueingSegmentListener<K,V,E extends Event<K,V>> extends IntConsumer
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 CompletionStage<Void>delayProcessing()Invoked to determine if processing should be delayed or not.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.booleanhandleEvent(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.ObjectmarkKeyAsProcessing(K key)This should be invoked on a key before actually processing the data.CompletionStage<Void>transferComplete()This is needed to tell the handler when the complete iteration is done.-
Methods inherited from interface java.util.function.IntConsumer
accept, andThen
-
-
-
-
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:
-
delayProcessing
CompletionStage<Void> delayProcessing()
Invoked to determine if processing should be delayed or not. Will returnCompletableFutures.completedNull()if processing can continue immediately, otherwise should wait until this is complete.- Returns:
- null if no notifications are required or a non null CompletionStage that when completed all notifications are done
-
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
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.
-
-