Package ibis.cashmere.constellation
Class BufferCache
- java.lang.Object
-
- ibis.cashmere.constellation.BufferCache
-
public class BufferCache extends java.lang.Object
A wrapper forByteBufferCache
.
-
-
Constructor Summary
Constructors Constructor Description BufferCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Buffer
getBuffer(int sizeBuffer, boolean needsClearing)
Obtains aBuffer
of the specified size.static void
initializeBuffers(int sizeBuffer, int nrBuffers)
Initializes the buffer cache with the specified number of buffers of the specified size.static void
makeAvailableBuffer(Buffer b)
Make the specifiedBuffer
available for use, that is, append it to the list of available buffers.
-
-
-
Method Detail
-
makeAvailableBuffer
public static void makeAvailableBuffer(Buffer b)
Make the specifiedBuffer
available for use, that is, append it to the list of available buffers.- Parameters:
b
- aBuffer
value
-
getBuffer
public static Buffer getBuffer(int sizeBuffer, boolean needsClearing)
Obtains aBuffer
of the specified size. If one cannot be found in the cache, a new one is allocated. If it needs to be clear(ed), the needsClearing flag should be set to true.- Parameters:
sizeBuffer
- the size of theBuffer
to be obtainedneedsClearing
- whether theBuffer
needs to be cleared- Returns:
- the obtained
Buffer
-
initializeBuffers
public static void initializeBuffers(int sizeBuffer, int nrBuffers)
Initializes the buffer cache with the specified number of buffers of the specified size.- Parameters:
sizeBuffer
- the size of the buffersnrBuffers
- the number of buffers that need to be initialized
-
-