<div dir="ltr">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).</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Alan Bateman <<a href="mailto:alan.bateman@oracle.com">alan.bateman@oracle.com</a>> ezt írta (időpont: 2025. dec. 15., H, 21:32):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 15/12/2025 19:29, Attila Kelemen wrote:<br>
> If I'm understanding your problem correctly, then you can just use <br>
> semaphores to limit the number of concurrent actions.<br>
><br>
There are a few other threads to the same topic in the archives. Using a <br>
ThreadFactory that limits concurrency is one of the options that others <br>
were trying out.<br>
<br>
-Alan<br>
</blockquote></div>