| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| private final Pool. | |
| private static final int | |
| private final Queue | |
| private final AtomicInteger |
| Modifier and Type | Method and Description |
|---|---|
| public T | Returns: An object.If the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object. |
| public void |
| allocator | back to summary |
|---|---|
| private final Pool. | |
| MAX_QUEUE_SIZE | back to summary |
|---|---|
| private static final int MAX_QUEUE_SIZE | |
| objectQueue | back to summary |
|---|---|
| private final Queue<T> objectQueue | |
| size | back to summary |
|---|---|
| private final AtomicInteger size | |
| Pool | back to summary |
|---|---|
| pack-priv Pool(Pool. | |
| getOrCreate | back to summary |
|---|---|
| public T getOrCreate() If the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object.
| |
| returnToPool | back to summary |
|---|---|
| public void returnToPool(T object) Adds the provided instance to the pool. If the pool is full, the instance will be discarded. Callers MUST NOT use an object after returning it to the pool.
| |
| Modifier and Type | Method and Description |
|---|---|
| public T | Returns: a new instance.the pool to which the new object will be linked. pool)Allocate a new object and link it to the given pool. |
| newInstance | back to summary |
|---|---|
| public T newInstance(Pool<T> pool) Allocate a new object and link it to the given pool.
| |