Package io.undertow.server
Class DefaultByteBufferPool
- java.lang.Object
-
- io.undertow.server.DefaultByteBufferPool
-
- All Implemented Interfaces:
ByteBufferPool,Closeable,AutoCloseable
public class DefaultByteBufferPool extends Object implements ByteBufferPool
A byte buffer pool that supports reference counted pools.- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description DefaultByteBufferPool(boolean direct, int bufferSize)DefaultByteBufferPool(boolean direct, int bufferSize, int maximumPoolSize, int threadLocalCacheSize)DefaultByteBufferPool(boolean direct, int bufferSize, int maximumPoolSize, int threadLocalCacheSize, int leakDecetionPercent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PooledByteBufferallocate()voidclose()protected voidfinalize()ByteBufferPoolgetArrayBackedPool()If this byte buffer pool corresponds to an array backed pool then this will return itself.intgetBufferSize()booleanisDirect()
-
-
-
Constructor Detail
-
DefaultByteBufferPool
public DefaultByteBufferPool(boolean direct, int bufferSize)- Parameters:
direct- If this implementation should use direct buffersbufferSize- The buffer size to use
-
DefaultByteBufferPool
public DefaultByteBufferPool(boolean direct, int bufferSize, int maximumPoolSize, int threadLocalCacheSize, int leakDecetionPercent)- Parameters:
direct- If this implementation should use direct buffersbufferSize- The buffer size to usemaximumPoolSize- The maximum pool size, in number of buffers, it does not include buffers in thread local cachesthreadLocalCacheSize- The maximum number of buffers that can be stored in a thread local cache
-
DefaultByteBufferPool
public DefaultByteBufferPool(boolean direct, int bufferSize, int maximumPoolSize, int threadLocalCacheSize)- Parameters:
direct- If this implementation should use direct buffersbufferSize- The buffer size to usemaximumPoolSize- The maximum pool size, in number of buffers, it does not include buffers in thread local cachesthreadLocalCacheSize- The maximum number of buffers that can be stored in a thread local cache
-
-
Method Detail
-
getBufferSize
public int getBufferSize()
- Specified by:
getBufferSizein interfaceByteBufferPool
-
isDirect
public boolean isDirect()
- Specified by:
isDirectin interfaceByteBufferPool
-
allocate
public PooledByteBuffer allocate()
- Specified by:
allocatein interfaceByteBufferPool
-
getArrayBackedPool
public ByteBufferPool getArrayBackedPool()
Description copied from interface:ByteBufferPoolIf this byte buffer pool corresponds to an array backed pool then this will return itself. Otherwise it will return an array backed pool that contains buffers of the same size.- Specified by:
getArrayBackedPoolin interfaceByteBufferPool- Returns:
- An array backed pool of the same size
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceByteBufferPool- Specified by:
closein interfaceCloseable
-
-