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 | Method and Description |
---|---|
R |
allocate()
Allocates a resource from this pool.
|
void |
release(R resource)
Releases a previously allocated resource to this pool.
|
@CreatesObligation 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.
@DischargesObligation void release(R resource) throws X extends Exception
resource
- a resource.IllegalArgumentException
- if the given resource has not been
allocated by this pool and the implementation cannot tolerate
this.X
- if releasing the resource fails for any other reason.X extends Exception
Copyright © 2012–2014 Schlichtherle IT Services. All rights reserved.