Interface BufferAllocator.PooledOptionBuilder
- Enclosing interface:
BufferAllocator
-
Method Summary
Modifier and TypeMethodDescriptionmaxByteBufferCapacity(int capacity) Sets the maximum capacity, in bytes, that may be requested byBufferAllocator.getByteBuffer(int).maxByteBufferPoolCapacity(int capacity) Sets the maximum capacity of the byte buffer pool.maxCharBufferCapacity(int capacity) Sets the maximum capacity, in chars, that may be requested byBufferAllocator.getCharBuffer(int).maxCharBufferPoolCapacity(int capacity) Sets the maximum capacity of the char buffer pool.maxPooledByteBufferCapacity(int capacity) Sets the maximum capacity, in bytes, of a pooled byte buffer.maxPooledCharBufferCapacity(int capacity) Sets the maximum capacity, in chars, of a pooled char buffer.preferDirectBuffers(boolean flag) Sets whether to preferably allocate direct byte buffers.
-
Method Details
-
maxByteBufferCapacity
Sets the maximum capacity, in bytes, that may be requested by
BufferAllocator.getByteBuffer(int).If
BufferAllocator.getByteBuffer(int)is called with an argument greater thancapacity,MxPackException.SizeLimitExceededis thrown.Default:
Integer.MAX_VALUE- Parameters:
capacity- the maximum capacity, in bytes, that may be requested byBufferAllocator.getByteBuffer(int)- Returns:
- this builder
-
maxCharBufferCapacity
Sets the maximum capacity, in chars, that may be requested by
BufferAllocator.getCharBuffer(int).If
BufferAllocator.getCharBuffer(int)is called with an argument greater thancapacity,MxPackException.SizeLimitExceededis thrown.Default:
Integer.MAX_VALUE- Parameters:
capacity- the maximum capacity, in chars, that may be requested byBufferAllocator.getCharBuffer(int)- Returns:
- this builder
-
maxPooledByteBufferCapacity
Sets the maximum capacity, in bytes, of a pooled byte buffer.
If
BufferAllocator.getByteBuffer(int)is called with an argument greater thancapacity, an unpooled heap buffer is returned.Default:
1024 * 1024- Parameters:
capacity- the maximum capacity, in bytes, of a pooled byte buffer- Returns:
- this builder
-
maxPooledCharBufferCapacity
Sets the maximum capacity, in chars, of a pooled char buffer.
If
BufferAllocator.getCharBuffer(int)is called with an argument greater thancapacity, an unpooled buffer is returned.Default:
1024 * 512- Parameters:
capacity- the maximum capacity, in chars, of a pooled char buffer- Returns:
- this builder
-
maxByteBufferPoolCapacity
Sets the maximum capacity of the byte buffer pool.
If the byte buffer pool runs out of buffers after the maximum pool capacity has been reached, additional unpooled byte buffers are allocated on the heap.
Default:
1024 * 1024 * 64- Parameters:
capacity- the maximum capacity of the byte buffer pool- Returns:
- this builder
-
maxCharBufferPoolCapacity
Sets the maximum capacity of the char buffer pool.
If the char buffer pool runs out of buffers after the maximum pool capacity has been reached, additional unpooled char buffers are allocated.
Default:
1024 * 1024 * 32- Parameters:
capacity- the maximum capacity of the char buffer pool- Returns:
- this builder
-
preferDirectBuffers
Sets whether to preferably allocate direct byte buffers.
If set to
true, byte buffers are preferably allocated withByteBuffer.allocateDirect(int). If set tofalse, byte buffers are allocated withByteBuffer.allocate(int).If the byte buffer pool runs out of buffers after the maximum pool capacity has been reached, additional unpooled buffers are allocated with
ByteBuffer.allocate(int)even if this option is set totrue.This option does not apply to char buffers, which are always allocated with
CharBuffer.allocate(int).Default:
false- Parameters:
flag- whether to preferably allocate direct byte buffers- Returns:
- this builder`
-