Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.comm.utils.nio
Class ByteBufferPool

public class ByteBufferPool      
 
 

Field Summary
ByteOrder
private final int
private final ByteOrder
private static Logger
private final long
Constructor Summary
public void
ByteBufferPool(Integer maxBuffers, Integer bufferCapacity, ByteOrder byteOrder)
Method Summary
public synchronized void
protected ByteBuffer
createBuffer(Integer capacity)
public ByteBuffer
get()
public ByteOrder
public synchronized void
put(ByteBuffer buffer)
public synchronized String
Field Detail
bufferCapacity
private final int bufferCapacity
Final.
Multiplicity:
1
 

byteOrder
ByteOrder byteOrder
 

byteOrder
private final ByteOrder byteOrder
Final.
Multiplicity:
1
 

logger
private static Logger logger
Multiplicity:
1
Static.
 

maxBuffers
private final long maxBuffers
Final.
Multiplicity:
1
 
Constructor Detail
ByteBufferPool
public void ByteBufferPool (Integer maxBuffers, Integer bufferCapacity, ByteOrder byteOrder)
 
Creates a new pool with the given properties.
Stereotype:
create
 
Method Detail
clear
public synchronized void clear ()
 
Removes all buffers from the pool.
Synchronized.
 

createBuffer
protected ByteBuffer createBuffer (Integer capacity)
 
Tries to allocate a direct buffer first, and if it can't,
allocates it from the heap. This method can be overriden in
order to create custom bytebuffers.
 

get
public ByteBuffer get ()
 
Returns a cleared buffer from the pool. No implementation
for now, just plain create a new buffer.
Return:
a buffer from the pool.
 

getByteOrder
public ByteOrder getByteOrder ()
 
Returns the byte order used when returning buffers.
 

put
public synchronized void put (ByteBuffer buffer)
 
Returns the buffer back to the pool
Parameters:
buffer the buffer to put into the pool.
Synchronized.
 

toString
public synchronized String toString ()
 
Returns a summary statistics representation of the receiver.
Synchronized.
 

Class
Tree
          
PREV CLASS NEXT CLASS
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD