| Modifier and Type | Field and Description |
|---|---|
| private final List | freeStack
Stack of given objects this points to. |
| private final Class | objectType
Type of objects in this pool. |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ObjectPool(String
Fully qualified name of the type of objects for this pool. className)Constructor ObjectPool |
| public | ObjectPool(Class<?>
Type of objects for this pool type, int Size of vector to allocate size)Constructor ObjectPool |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public synchronized Object | Returns: An instance of the given objectGet an instance of the given object in this pool |
| public synchronized Object | Returns: an instance of the given object if available or nullGet an instance of the given object in this pool if available |
| freeStack | back to summary |
|---|---|
| private final List<Object> freeStack Stack of given objects this points to.
| |
| objectType | back to summary |
|---|---|
| private final Class<?> objectType Type of objects in this pool. | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID | |
| ObjectPool | back to summary |
|---|---|
| public ObjectPool(Class<?> type) Constructor ObjectPool
| |
| ObjectPool | back to summary |
|---|---|
| public ObjectPool(String className) Constructor ObjectPool
| |
| ObjectPool | back to summary |
|---|---|
| public ObjectPool(Class<?> type, int size) Constructor ObjectPool
| |
| ObjectPool | back to summary |
|---|---|
| public ObjectPool() Constructor ObjectPool | |
| freeInstance | back to summary |
|---|---|
| public synchronized void freeInstance(Object obj) Add an instance of the given object to the pool
| |
| getInstance | back to summary |
|---|---|
| public synchronized Object getInstance() Get an instance of the given object in this pool
| |
| getInstanceIfFree | back to summary |
|---|---|
| public synchronized Object getInstanceIfFree() Get an instance of the given object in this pool if available
| |