Register / Login
Win a copy of
Cross-Platform Desktop Applications: Using Node, Electron, and NW.js
this week in the
this forum made possible by our volunteer staff, including ...
Roel De Nijs
Stephan van Hulst
Threads and Synchronization
Thread pools, paced and exclusive tasks
posted 7 years ago
I have a
pool that I've created to handle some background processing in my app. I have three kinds of tasks that I need to run.
1. Normal task. This works correctly.
2. Paced task. This task can run concurrent with others, but can only run so often. I need it to play nice and not run multiple jobs at the same time.
3. Exclusive task. Only one of these can be running at a time. If a second gets added to the queue, it needs to interrupt the first one and take over.
Is there a way to handle this without making separate thread pools for each task? Or writing a custom ExecutorService?
It is sorta covered in the
JavaRanch Style Guide
Boost this thread!
How can I serialize thread handling with Java 5's java.util.concurrent package?
Multiple Thread Pool Framework - HowTo
How to set thread name when using Future/FutureTask mechanism
Thread-based timer versus Timer Class-based timer