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 ofByteBufferPool
which 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 ByteBuffer
borrowBuffer()
Extract a buffer from the pool.protected ByteBuffer
createBuffer()
boolean
isUseDirect()
void
returnBuffer(ByteBuffer buffer)
Returns the buffer to the pool or just discards it for a non-pool strategyvoid
setDefaultSize(int defaultSize)
Sets the default size of the buffersvoid
setUseDirect(boolean useDirect)
Sets whether direct buffers are used or notvoid
start()
void
stop()
-
-
-
Method Detail
-
borrowBuffer
public ByteBuffer borrowBuffer()
Description copied from interface:ByteBufferPool
Extract a buffer from the pool.- Specified by:
borrowBuffer
in interfaceByteBufferPool
-
returnBuffer
public void returnBuffer(ByteBuffer buffer)
Description copied from interface:ByteBufferPool
Returns the buffer to the pool or just discards it for a non-pool strategy- Specified by:
returnBuffer
in interfaceByteBufferPool
-
setDefaultSize
public void setDefaultSize(int defaultSize)
Description copied from interface:ByteBufferPool
Sets the default size of the buffers- Specified by:
setDefaultSize
in 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()
-
-