public class Pool<T> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Pool.Recycler<T>
A Recycler puts objects into the pool that the recycler is associated with.
|
Constructor and Description |
---|
Pool(int poolCapacity)
Creates a pool with the given capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T object)
Adds an entry to the pool with an optional payload.
|
T |
pollEntry()
Gets the next cached entry.
|
T |
pollEntry(java.time.Duration timeout) |
Pool.Recycler<T> |
recycler()
Gets the recycler for this pool.
|
T |
tryPollEntry()
Tries to get the next cached entry.
|
public Pool(int poolCapacity)
public Pool.Recycler<T> recycler()
public void add(T object)
public T pollEntry() throws InterruptedException
InterruptedException
public T pollEntry(java.time.Duration timeout) throws InterruptedException
InterruptedException
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.