Package org.eclipse.jetty.util
Enum Pool.StrategyType
- java.lang.Object
-
- java.lang.Enum<Pool.StrategyType>
-
- org.eclipse.jetty.util.Pool.StrategyType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Pool.StrategyType>
public static enum Pool.StrategyType extends java.lang.Enum<Pool.StrategyType>
The type of the strategy to use for the pool. The strategy primarily determines where iteration over the pool entries begins.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FIRST
A strategy that looks for an entry always starting from the first entry.RANDOM
A strategy that looks for an entry by iterating from a random starting index.ROUND_ROBIN
A strategy that looks for an entry by iterating from a starting point that is incremented on every search.THREAD_ID
A strategy that uses theThread.getId()
of the current thread to select a starting point for an entry search.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pool.StrategyType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Pool.StrategyType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FIRST
public static final Pool.StrategyType FIRST
A strategy that looks for an entry always starting from the first entry. It will favour the early entries in the pool, but may contend on them more.
-
RANDOM
public static final Pool.StrategyType RANDOM
A strategy that looks for an entry by iterating from a random starting index. No entries are favoured and contention is reduced.
-
THREAD_ID
public static final Pool.StrategyType THREAD_ID
A strategy that uses theThread.getId()
of the current thread to select a starting point for an entry search. Whilst not as performant as using theThreadLocal
cache, it may be suitable when the pool is substantially smaller than the number of available threads. No entries are favoured and contention is reduced.
-
ROUND_ROBIN
public static final Pool.StrategyType ROUND_ROBIN
A strategy that looks for an entry by iterating from a starting point that is incremented on every search. This gives similar results to the random strategy but with more predictable behaviour. No entries are favoured and contention is reduced.
-
-
Method Detail
-
values
public static Pool.StrategyType[] 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 (Pool.StrategyType c : Pool.StrategyType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Pool.StrategyType 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
-
-