public class DefaultThreadPool extends Object
| Constructor and Description |
|---|
DefaultThreadPool(int poolSize,
boolean syncThreads)
Create a new pool.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the pool i.e, stop pooling threads.
|
void |
configure(int poolSize)
Configure a new pool size.
|
boolean |
executeTask(Runnable task)
Execute the task in a free thread or create a new one.
|
int |
getPoolSize()
Returns current pool size.
|
public DefaultThreadPool(int poolSize,
boolean syncThreads)
poolSize - The size of the poolsyncThreads - Sync or async poolpublic void configure(int poolSize)
poolSize - The pool sizepublic int getPoolSize()
public void close()
public boolean executeTask(Runnable task)
task - The task to executetrue if the task execution could be scheduled, false otherwise.Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.