Class ThresholdPushbackPolicy<T,U extends BlockingQueue<PushEvent<? extends T>>>

java.lang.Object
org.osgi.util.pushstream.ThresholdPushbackPolicy<T,U>
Type Parameters:
T - The type of objects in the PushEvent
U - The type of the Queue used in the user specified buffer
All Implemented Interfaces:
PushbackPolicy<T,U>

public final class ThresholdPushbackPolicy<T,U extends BlockingQueue<PushEvent<? extends T>>> extends Object implements PushbackPolicy<T,U>
Provides a configurable PushbackPolicy implementation that returns zero back pressure until the buffer fills beyond the supplied threshold. Once the threshold is reached back pressure is returned based on the supplied parameters.

The starting level of the back pressure once the threshold is exceeded is defined using the initial parameter. Additional back pressure is applied for each queued item over the threshold. The amount of this additional back pressure is defined by the increment parameter.

The following common use cases are supported:

  • The increment size can be zero, returning the initial value as a fixed back pressure after the threshold is exceeded.
  • The initial value can be zero, returning a linearly increasing back pressure from zero once the threshold is exceeded
Since:
1.1