| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public T | allocate(Slot
The slot the pool wish to allocate an object for.
Implementers do not need to concern themselves with the details of a
pools slot objects. They just have to call release on them as the
protocol demands. slot)Implements stormpot. |
| public void | deallocate(T
The non-null Poolable instance to be deallocated. poolable)Implements stormpot. |
| public T | reallocate(Slot
The slot the pool wish to allocate an object for.
Implementers do not need to concern themselves with the details of a
pools slot objects. They just have to call release on them as the
protocol demands. slot, T The non-null Poolable instance to be reallocated. poolable)Implements stormpot. |
| pack-priv Allocator |
| allocator | back to summary |
|---|---|
| pack-priv final Allocator<T> allocator | |
| ReallocatingAdaptor | back to summary |
|---|---|
| pack-priv ReallocatingAdaptor(Allocator<T> allocator) | |
| allocate | back to summary |
|---|---|
| public T allocate(Slot slot) throws Exception Implements stormpot. Doc from stormpot. Create a fresh new instance of T for the given slot.
The returned
| |
| deallocate | back to summary |
|---|---|
| public void deallocate(T poolable) throws Exception Implements stormpot. Doc from stormpot. Deallocate, if applicable, the given Poolable and free any resources
associated with it.
This is an opportunity to close any connections or files, flush buffers,
empty caches or what ever might need to be done to completely free any
resources represented by this Poolable.
Note that a Poolable must never touch its slot object after it has been
deallocated.
Pools, on the other hand, will guarantee that the same object is never
deallocated more than once.
Note that pools will always silently swallow exceptions thrown by the
deallocate method. They do this because there is no knowing whether the
deallocation of an object will be done synchronously by a thread calling
| |
| reallocate | back to summary |
|---|---|
| public T reallocate(Slot slot, T poolable) throws Exception Implements stormpot. Doc from stormpot. Possibly reallocate the given instance of T for the given slot, and
return it if the reallocation was successful, or a fresh replacement if
the instance could not be reallocated.
This method is effectively equivalent to the following:
[source,java]
--
include::src/test/java/examples/Examples.java[tag=reallocatorExample]
--
With the only difference that it may, if possible, reuse the given
expired Poolable, either wholly or in part.
The state stored in the
| |
| unwrap | back to summary |
|---|---|
| pack-priv Allocator | |