T
- the type of resource this pool managespublic interface Pool<T> extends Closeable
Modifier and Type | Method and Description |
---|---|
T |
acquire()
Acquires a resource from the pool.
|
T |
acquire(long time,
TimeUnit unit)
Acquires a resource from the pool.
|
void |
release(T resource)
Releases the resource to the pool.
|
int |
size() |
T acquire() throws IOException
IOException
T acquire(long time, TimeUnit unit) throws TimeoutException, IOException
time
- time it takes before timeout if no resource is availableunit
- the unit of the timeTimeoutException
IOException
void release(T resource)
resource
- the resource to releaseint size()
Copyright © 2023. All Rights Reserved.