Class ThreadPools
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic ScheduledExecutorServiceA sharedScheduledExecutorServicethat REST catalogs can use for refreshing their authentication data.static ExecutorServiceReturn anExecutorServicethat uses the "delete worker" thread-pool.static ExecutorServiceReturn anExecutorServicethat uses the "worker" thread-pool.static ScheduledExecutorServicenewExitingScheduledPool(String namePrefix, int poolSize, Duration terminationTimeout) Create a newScheduledExecutorServicewith the given name and pool size.static ExecutorServicenewExitingWorkerPool(String namePrefix, int poolSize) Creates a fixed-size thread pool that uses daemon threads and registers a shutdown hook to ensure the pool terminates when the JVM exits.static ExecutorServicenewFixedThreadPool(String namePrefix, int poolSize) Creates a fixed-size thread pool that uses daemon threads.static ScheduledExecutorServicenewScheduledPool(String namePrefix, int poolSize) Create a newScheduledExecutorServicewith the given name and pool size.
-
Field Details
-
WORKER_THREAD_POOL_SIZE
public static final int WORKER_THREAD_POOL_SIZE -
DELETE_WORKER_THREAD_POOL_SIZE
public static final int DELETE_WORKER_THREAD_POOL_SIZE -
AUTH_REFRESH_THREAD_POOL_SIZE
public static final int AUTH_REFRESH_THREAD_POOL_SIZE
-
-
Method Details
-
getWorkerPool
Return anExecutorServicethat uses the "worker" thread-pool.The size of the worker pool limits the number of tasks concurrently reading manifests in the base table implementation across all concurrent planning operations.
The size of this thread-pool is controlled by the Java system property
iceberg.worker.num-threads.- Returns:
- an
ExecutorServicethat uses the worker pool
-
getDeleteWorkerPool
Return anExecutorServicethat uses the "delete worker" thread-pool.The size of this worker pool limits the number of tasks concurrently reading delete files within a single JVM. If there are multiple threads loading deletes, all of them will share this worker pool by default.
The size of this thread-pool is controlled by the Java system property
iceberg.worker.delete-num-threads.- Returns:
- an
ExecutorServicethat uses the delete worker pool
-
authRefreshPool
A sharedScheduledExecutorServicethat REST catalogs can use for refreshing their authentication data. -
newExitingWorkerPool
Creates a fixed-size thread pool that uses daemon threads and registers a shutdown hook to ensure the pool terminates when the JVM exits. This is suitable for long-lived thread pools that should be automatically cleaned up on JVM shutdown. -
newFixedThreadPool
Creates a fixed-size thread pool that uses daemon threads. -
newScheduledPool
Create a newScheduledExecutorServicewith the given name and pool size.Threads used by this service will be daemon threads.
- Parameters:
namePrefix- a base name for threads in the executor service's thread poolpoolSize- max number of threads to use- Returns:
- an executor service
-
newExitingScheduledPool
public static ScheduledExecutorService newExitingScheduledPool(String namePrefix, int poolSize, Duration terminationTimeout) Create a newScheduledExecutorServicewith the given name and pool size.Threads used by this service will be daemon threads.
The service registers a shutdown hook to ensure that it terminates when the JVM exits. This is suitable for long-lived thread pools that should be automatically cleaned up on JVM shutdown.
-