@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public interface Pool<R,E 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<E extends Exception>
This interface is designed to be used with Pools which enable their
resources to release itself.
|
R allocate() throws E extends Exception
Mind that a pool implementation should not hold references to its allocated resources because this could cause a memory leak.
Exception - if allocating the resource failed for any reason.void release(R resource) throws E 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.Exception - if releasing the resource failed for any other reason.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.