Enum Class PoolingPolicy
- All Implemented Interfaces:
Serializable,Comparable<PoolingPolicy>,Constable
Define a policy for allocating buffers.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUse Direct memory for all buffers and pool the memory.Allocate memory from JVM heap without any pooling. -
Method Summary
Modifier and TypeMethodDescriptionstatic PoolingPolicyReturns the enum constant of this class with the specified name.static PoolingPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UnpooledHeap
Allocate memory from JVM heap without any pooling.This option has the least overhead in terms of memory usage since the memory will be automatically reclaimed by the JVM GC but might impose a performance penalty at high throughput.
-
PooledDirect
Use Direct memory for all buffers and pool the memory.Direct memory will avoid the overhead of JVM GC and most memory copies when reading and writing to socket channel.
Pooling will add memory space overhead due to the fact that there will be fragmentation in the allocator and that threads will keep a portion of memory as thread-local to avoid contention when possible.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-