Package io.pravega.common.concurrent
Class LatestItemSequentialProcessor<ItemType>
- java.lang.Object
-
- io.pravega.common.concurrent.LatestItemSequentialProcessor<ItemType>
-
- Type Parameters:
ItemType- The type of item to be processed.
public class LatestItemSequentialProcessor<ItemType> extends java.lang.ObjectProvides a way to run a provided function on items but guarantees that the function is only invoked for one item at a time. If multiple 'updates' to the item are provided while the processor is running, only the most recent is passed to the function. This allows it to 'skip' updates for items that are not the most recent value.
-
-
Constructor Summary
Constructors Constructor Description LatestItemSequentialProcessor(java.util.function.Consumer<ItemType> processFunction, java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidupdateItem(ItemType newItem)Updates the item and triggers it to be processed.
-
-
-
Constructor Detail
-
LatestItemSequentialProcessor
public LatestItemSequentialProcessor(java.util.function.Consumer<ItemType> processFunction, java.util.concurrent.Executor executor)
-
-
Method Detail
-
updateItem
public void updateItem(ItemType newItem)
Updates the item and triggers it to be processed.- Parameters:
newItem- The item to be processed. (Cannot be null)
-
-