public class CharArrayPoolImpl extends AbstractPool<char[]> implements CharArrayPool
Pool
interface for char-arrays.Modifier and Type | Field and Description |
---|---|
private int |
arrayLength
The actual length of the char-arrays.
|
static int |
DEFAULT_ARRAY_LENGTH
The default array length.
|
DEFAULT_CAPACITY
Constructor and Description |
---|
CharArrayPoolImpl()
The constructor.
|
CharArrayPoolImpl(int capacity,
int arrayLength)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected char[] |
create()
This method creates a new element.
|
protected boolean |
reset(char[] element)
This method resets the given
element so it can be reused. |
borrow, clear, getCapacity, getSize, isEmpty, release
public static final int DEFAULT_ARRAY_LENGTH
private final int arrayLength
public CharArrayPoolImpl()
public CharArrayPoolImpl(int capacity, int arrayLength)
capacity
- is the capacity
of the pool.arrayLength
- is the length of each pooled byte-array.protected char[] create()
AbstractPool
create
in class AbstractPool<char[]>
protected boolean reset(char[] element)
AbstractPool
element
so it can be reused. It is called if an element is
released
and will be stored in the pool. The implementation depends on the type of
element. Some types may become inconsistent if they are directly reused. Further this method may clear data from
the element for security reasons, because the same instance may be given to some other component that is NOT
trusted enough (because it may be vulnerably).reset
in class AbstractPool<char[]>
element
- the element to reset.true
if the given element
can be reused and should be added to the pool, false
otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.