Class SimpleBufferPool
- java.lang.Object
-
- org.apache.activemq.transport.udp.SimpleBufferPool
-
- All Implemented Interfaces:
Service,ByteBufferPool
- Direct Known Subclasses:
DefaultBufferPool
public class SimpleBufferPool extends Object implements ByteBufferPool
A simple implementation ofByteBufferPoolwhich does no pooling and just creates new buffers each time
-
-
Constructor Summary
Constructors Constructor Description SimpleBufferPool()SimpleBufferPool(boolean useDirect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferborrowBuffer()Extract a buffer from the pool.protected ByteBuffercreateBuffer()booleanisUseDirect()voidreturnBuffer(ByteBuffer buffer)Returns the buffer to the pool or just discards it for a non-pool strategyvoidsetDefaultSize(int defaultSize)Sets the default size of the buffersvoidsetUseDirect(boolean useDirect)Sets whether direct buffers are used or notvoidstart()voidstop()
-
-
-
Method Detail
-
borrowBuffer
public ByteBuffer borrowBuffer()
Description copied from interface:ByteBufferPoolExtract a buffer from the pool.- Specified by:
borrowBufferin interfaceByteBufferPool
-
returnBuffer
public void returnBuffer(ByteBuffer buffer)
Description copied from interface:ByteBufferPoolReturns the buffer to the pool or just discards it for a non-pool strategy- Specified by:
returnBufferin interfaceByteBufferPool
-
setDefaultSize
public void setDefaultSize(int defaultSize)
Description copied from interface:ByteBufferPoolSets the default size of the buffers- Specified by:
setDefaultSizein interfaceByteBufferPool
-
isUseDirect
public boolean isUseDirect()
-
setUseDirect
public void setUseDirect(boolean useDirect)
Sets whether direct buffers are used or not
-
start
public void start() throws Exception
-
createBuffer
protected ByteBuffer createBuffer()
-
-