org.objectweb.jonathan.resources.lib
Class JChunkFactory
- ChunkFactory
public class JChunkFactory
A Chunk Factory implementation.
A chunk factory creates and manages chunks. This chunk factory manages two
pools of chunks of different sizes, so that a released chunk may be reused
in a different context, saving the time for allocating and collecting the
associated memory. The sizes of the chunks used, and of the preallocated
pools may be changed.
boolean | verbose - Indicates whether warning message should be printed to stderr.
|
JChunkFactory() - Returns a new chunk factory
|
JChunkFactory(int big_pool_size, int big_size, int small_pool_size, int small_size, boolean verbose) - Returns a new chunk factory
|
Chunk | newChunk() - Returns a chunk of a default (small) size.
|
Chunk | newChunk(int size) - Returns a chunk of (at least) the specified size.
|
verbose
public boolean verbose
Indicates whether warning message should be printed to stderr.
In particular, if verbose is true, and if all the chunks in a pool are used,
a warning will be emitted. This may be useful to tune the pool sizes.
This value is defined under the name "/jonathan/JChunkFactory/verbose"
in the
bootstrap context
.
JChunkFactory
public JChunkFactory()
Returns a new chunk factory
JChunkFactory
public JChunkFactory(int big_pool_size,
int big_size,
int small_pool_size,
int small_size,
boolean verbose)
Returns a new chunk factory
big_pool_size
- size of the big chunks poolbig_size
- size of the big chunkssmall_pool_size
- size of the small chunks poolsmall_size
- size of the small chunksverbose
- indicates whether warning messages should be printed to
stderr.
verbose
newChunk
public Chunk newChunk(int size)
Returns a chunk of (at least) the specified size.
This method may return a larger chunk than expected.
- newChunk in interface ChunkFactory
size
- the expected size of the chunk.
- a chunk