R
- The type of the resources managed by this pool.X
- The type of the exceptions thrown by this pool.public interface Pool<R,X extends Exception>
Implementations must be thread-safe. However, this does not necessarily apply to the implementation of its managed resources.
Modifier and Type | Interface and Description |
---|---|
static interface |
Pool.Releasable<X extends Exception>
This interface is designed to be used with Pools which enable their
resources to release itself.
|
R allocate() throws X extends Exception
Mind that a pool implementation should not hold references to its allocated resources because this could cause a memory leak.
void release(R resource) throws X extends Exception
IllegalArgumentException
or an
IllegalStateException
upon the conditions explained below.resource
- a resource.RuntimeException
- if the given resource has not been allocated
by this pool or has already been released to this pool and the
implementation cannot tolerate this.X
- if releasing the resource failed for any other reason.X extends Exception
Copyright © 2005–2013 Schlichtherle IT Services. All rights reserved.