Class ThrottlingAggregator<T>
- java.lang.Object
-
- com.inductiveautomation.ignition.common.util.ThrottlingAggregator<T>
-
public class ThrottlingAggregator<T> extends java.lang.Object
Aggregates items, grouping them if they are submitted consecutively within a specified delay or if a specified maximum delivery frequency dictates that no more deliveries can be made at the time.Delivery happens when either of the following occur:
- The time since the last item submitted is longer than the specified delay and a delivery wasn't sent out too recently.
- There are items waiting to be delivered and a period of time longer than the specified frequency elapses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ThrottlingAggregator.Callback<T>
-
Constructor Summary
Constructors Constructor Description ThrottlingAggregator(long delay, long maxFrequency, ThrottlingAggregator.Callback<T> callback)
Create aThrottlingAggregator
with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
processItem(T item)
-
-
-
Constructor Detail
-
ThrottlingAggregator
public ThrottlingAggregator(long delay, long maxFrequency, ThrottlingAggregator.Callback<T> callback)
Create aThrottlingAggregator
with the given parameters.- Parameters:
delay
- How long to wait for another call to processItem before attempting delivery. During this delay is where aggregation happens.maxFrequency
- The maximum frequency at which aggregated items should be delivered.callback
- A callback that aggregated items will be delivered to.
-
-
Method Detail
-
processItem
public void processItem(T item)
-
-