|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlPool<T>
public final class UtlPool<T extends UtlPool.Item<T>>
Implements a pool to recycle objects.
This class implements a pool used to recycle objects.
This class IS NOT intended to be used by end users.
Nested Class Summary | |
---|---|
static interface |
UtlPool.Factory<T extends UtlPool.Item<T>>
Defines the factory used by the pool to create new objects |
static interface |
UtlPool.FlushedItemReceiver<T extends UtlPool.Item<T>>
Interface through which flushed items are dispatched to the user |
static interface |
UtlPool.Item<T extends UtlPool.Item<T>>
Defines a 'poolable' item. |
static class |
UtlPool.Params
Specifies pool operating parameters. |
class |
UtlPool.Stats
Stores pool statistics |
Field Summary | |
---|---|
static boolean |
POOL_LEAK_TYPE_TRACKING_ENABLED
|
Method Summary | ||
---|---|---|
int |
capacity()
Return the current pool capacity |
|
void |
close()
Close the pool |
|
static
|
create(String type,
String name,
UtlPool.Factory<T> factory,
UtlPool.Params params)
Create a new object pool. |
|
static
|
createPoolArray(int size)
Creates an empty UtlPool array of the give size. |
|
void |
flush(UtlPool.FlushedItemReceiver<T> receiver)
Flush the pool |
|
T |
get(Object object)
Get an item from an object pool. |
|
boolean |
isClosed()
|
|
static boolean |
isDetachedWashEnabled()
Get whether detached wash is enabled |
|
static boolean |
isLockFreeConcurrencyEnabled()
Get whether lock free concurrency is enabled or not |
|
String |
key()
Get a pool's systemwide unique key |
|
String |
name()
Get a pool's name |
|
UtlPool.Params |
params()
Gets the creation UtlPool.Params for the pool. |
|
void |
put(T item)
Release an item back into the pool |
|
void |
setSingleThreaded()
Switch off threaded operation |
|
int |
size()
Return the number of items in the pool |
|
UtlPool.Stats |
stats()
Get the pool's statistics object |
|
String |
type()
Get a pool's type |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean POOL_LEAK_TYPE_TRACKING_ENABLED
Method Detail |
---|
public static <T extends UtlPool.Item<T>> UtlPool<T> create(String type, String name, UtlPool.Factory<T> factory, UtlPool.Params params)
type
- The pool's typename
- The pool's unique name within its type. The pool's type
and name together serve as a pool's unique system-wide key.factory
- The factory to be used to create objects stored by
the pool being created.params
- Specifies pool operating parameters.public static final <T extends UtlPool.Item<T>> UtlPool<T>[] createPoolArray(int size)
UtlPool
array of the give size.
size
- The size of the array.
UtlPool
array of the give size.public static final boolean isLockFreeConcurrencyEnabled()
public static final boolean isDetachedWashEnabled()
public final String type()
public final String name()
public final String key()
public final void setSingleThreaded()
public final T get(Object object)
object
- A user object passed to the item factory in case the
pool is empty and an item needs to be created fresh.
public final void put(T item)
public final int size()
public final int capacity()
public final UtlPool.Stats stats()
public final UtlPool.Params params()
UtlPool.Params
for the pool.
When a pool is created its UtlPool.Params
are cloned and marked as read only.
This method allows the caller to determine the UtlPool.Params
with which the
pool was created.
UtlPool.Params
.public final void flush(UtlPool.FlushedItemReceiver<T> receiver)
receiver
- Receives the flushed items. This parameter can be null.
This method flushes all pool entries.
public final boolean isClosed()
public final void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |