On Thu, Mar 11, 2021 at 5:20 PM Narsi Reddy Nallamilli
<narsi.nallami...@gmail.com> wrote:
>
> Hi,
>
> I want to be able to associate each runnable job id to thread so that I can
> associate that threads activity with that thread.
>
> Is the #counter in camel default thread pattern incremented every time a
> thread is used from the pool ?
>

No when a thread is created

> On Wed, Mar 10, 2021 at 11:37 PM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
> > 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
> >



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

Reply via email to