T - The type of object cached in the pool.@PublicEvolving public class Pool<T> extends Object
This pool can be used in the BulkFormat.Reader, when the returned objects are heavyweight
and need to be reused for efficiency. Because the reading happens in I/O threads while the record
processing happens in Flink's main processing threads, these objects cannot be reused immediately
after being returned. They can be reused, once they are recycled back to the pool.
| 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.
|
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
InterruptedExceptionCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.