Posts Tagged With "Java"

Java Fixed Work Pool

4 minute read Published:

At work I needed to create a fixed Java work pool. By “fixed”, I mean a pool that has no queue: it has a maximum number of workers, and it should not store work if it has no capacity to immediately process. Introducing the Players To accomplish this, I used the following classes: ThreadPoolExecutor – Executes work jobs LinkedBlockingQueue – Passes jobs to the thread pool ExecutorCompletionService – Gets results back from thread pool executions, and provides synchronization Instantiation I created the main thread pool using the following code:
LL