Yeah, I was on those threads. Though I much dislike the idea doing this with a `ThreadFactory`, because then you would have to do an `acquire` before returning a thread, and generally no API makes the promise that a thread created by the factory will be started (though would be unusual, but still I prefer to code for the contract). If you want to abstract it, then it is way better to hide this behind an `Executor` (or `ExecutorService`) where you can implement this properly (if we restrain ourselves to JDK interfaces).
Alan Bateman <[email protected]> ezt írta (időpont: 2025. dec. 15., H, 21:32): > > > On 15/12/2025 19:29, Attila Kelemen wrote: > > If I'm understanding your problem correctly, then you can just use > > semaphores to limit the number of concurrent actions. > > > There are a few other threads to the same topic in the archives. Using a > ThreadFactory that limits concurrency is one of the options that others > were trying out. > > -Alan >
