Package org.osgi.util.pushstream
Enum PushbackPolicyOption
- java.lang.Object
-
- java.lang.Enum<PushbackPolicyOption>
-
- org.osgi.util.pushstream.PushbackPolicyOption
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PushbackPolicyOption>
public enum PushbackPolicyOption extends java.lang.Enum<PushbackPolicyOption>
PushbackPolicyOption
provides a standard set of simplePushbackPolicy
implementations.- See Also:
PushbackPolicy
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FIXED
Returns a fixed amount of back pressure, independent of how full the buffer isLINEAR
Returns zero back pressure when the buffer is empty, then it returns a linearly increasing amount of back pressure based on how full the buffer is.ON_FULL_EXPONENTIAL
Returns zero back pressure until the buffer is full, then it returns an exponentially increasing amount, starting with the supplied value and doubling it each time.ON_FULL_FIXED
Returns zero back pressure until the buffer is full, then it returns a fixed value
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <T,U extends java.util.concurrent.BlockingQueue<PushEvent<? extends T>>>
PushbackPolicy<T,U>getPolicy(long value)
Create aPushbackPolicy
instance configured with a base back pressure time in nanoseconds The actual backpressure returned will vary based on the selected implementation, the base value, and the state of the buffer.static PushbackPolicyOption
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static PushbackPolicyOption[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FIXED
public static final PushbackPolicyOption FIXED
Returns a fixed amount of back pressure, independent of how full the buffer is
-
ON_FULL_FIXED
public static final PushbackPolicyOption ON_FULL_FIXED
Returns zero back pressure until the buffer is full, then it returns a fixed value
-
ON_FULL_EXPONENTIAL
public static final PushbackPolicyOption ON_FULL_EXPONENTIAL
Returns zero back pressure until the buffer is full, then it returns an exponentially increasing amount, starting with the supplied value and doubling it each time. Once the buffer is no longer full the back pressure returns to zero.
-
LINEAR
public static final PushbackPolicyOption LINEAR
Returns zero back pressure when the buffer is empty, then it returns a linearly increasing amount of back pressure based on how full the buffer is. The maximum value will be returned when the buffer is full.
-
-
Method Detail
-
values
public static PushbackPolicyOption[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PushbackPolicyOption c : PushbackPolicyOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PushbackPolicyOption valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getPolicy
public abstract <T,U extends java.util.concurrent.BlockingQueue<PushEvent<? extends T>>> PushbackPolicy<T,U> getPolicy(long value)
Create aPushbackPolicy
instance configured with a base back pressure time in nanoseconds The actual backpressure returned will vary based on the selected implementation, the base value, and the state of the buffer.- Parameters:
value
-- Returns:
- A
PushbackPolicy
to use
-
-