Hi

You can plugin your own thread pool factory where you can control how
thread pools (ExecutorService) are created and how these thread pools
create threads,
where you can do the before / after thread thingy.

However what is your use-case for doing this?



On Wed, Mar 10, 2021 at 2:06 PM Narsi Reddy Nallamilli
<narsi.nallami...@gmail.com> wrote:
>
> Hi,
>
> I have a executorservice build from threadpoolbuilder.
>
> public ExecutorService jobThreadPool() throws Exception {
>     return new 
> ThreadPoolBuilder(getContext()).poolSize(50).maxPoolSize(500).keepAliveTime(180).build("jobThread");
> }
>
> I would like to set thread before executing the task, just like as shown
>
> in example which is not recommended. How can we do it correctly? (like
> in 
> https://stackoverflow.com/questions/8523453/with-threadpoolexecutor-how-to-get-the-name-of-the-thread-running-in-the-thread)
>
> jobThreadPool.execute(() -> {
> //eg. Thread.getCurrentThread().setName("abc");
> });



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to