Package ibis.cashmere.constellation
Class BufferCache
- java.lang.Object
-
- ibis.cashmere.constellation.BufferCache
-
public class BufferCache extends java.lang.ObjectA wrapper forByteBufferCache.
-
-
Constructor Summary
Constructors Constructor Description BufferCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BuffergetBuffer(int sizeBuffer, boolean needsClearing)Obtains aBufferof the specified size.static voidinitializeBuffers(int sizeBuffer, int nrBuffers)Initializes the buffer cache with the specified number of buffers of the specified size.static voidmakeAvailableBuffer(Buffer b)Make the specifiedBufferavailable for use, that is, append it to the list of available buffers.
-
-
-
Method Detail
-
makeAvailableBuffer
public static void makeAvailableBuffer(Buffer b)
Make the specifiedBufferavailable for use, that is, append it to the list of available buffers.- Parameters:
b- aBuffervalue
-
getBuffer
public static Buffer getBuffer(int sizeBuffer, boolean needsClearing)
Obtains aBufferof 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 theBufferto be obtainedneedsClearing- whether theBufferneeds 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
-
-