java:threadpoolexecutor
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java:threadpoolexecutor [2025/02/22 08:02] – carl | java:threadpoolexecutor [2026/08/28 16:48] (current) – carl | ||
|---|---|---|---|
| Line 34: | Line 34: | ||
| + | ====== ScheduledThreadPoolExecutor ====== | ||
| + | This class is similar to ThreadPoolExecutor, | ||
| + | === Living without a Queue === | ||
| + | A consequence of not being able to bound the queue is that the thread count is more important: | ||
| + | |||
| + | * You cannot have a cached ScheduledThreadPoolExecutor. | ||
| + | * As mentioned in the javadocs, a core pool size of 0 is practically useless, since no threads will be alive to process the task. | ||
| + | * If all the threads in the ScheduledThreadPoolExecutor are busy (e.g. blocking), no new tasks can be executed. | ||
| + | |||
| + | |||
| + | |||
| + | ==== Experience using ThreadPoolExecutor ==== | ||
| + | |||
| + | 8/26/26 | ||
| + | I ran into an issue with our code. We tried to limit the number of threads doing work, so they acquired a semaphore, and released it later. | ||
| + | |||
| + | Replacing the Semaphore with an explicit queue only kinda worked, because a later bottle neck came up. The threads that were trying to queue the work did, got back the future from their work, and then blocked on that, consuming the thread again. | ||
java/threadpoolexecutor.1740211349.txt.gz · Last modified: by carl
