Forum Home » Fuse Distributions » Fuse Mediation Router

Thread: How to setThreadName() for .threads() in routeBuilder?

 
This question is answered.


Permlink Replies: 5 - Last Post: Aug 18, 2012 7:35 AM Last Post By: njiang Threads: [ Previous | Next ]
mikek753

Posts: 15
Registered: 09/03/10
How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 16, 2012 6:59 PM
 
  Click to reply to this thread Reply
hi,

I have as part of my route
from("...")
.threads(poolSize, maxPoolSize)
.beanRef(...);

How I can name my thread pool?
The ThreadsDefinition.setThreadName() is void
and threads() doesn't have any extra parameters to set pool name

the same applies to maxQueueSize

thanks.
njiang

Posts: 572
Registered: 09/17/07
Re: How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 17, 2012 4:14 AM   in response to: mikek753 in response to: mikek753
 
  Click to reply to this thread Reply
I just had a quick look at the thread DSL, and found it doesn't provide the thread method that you want, and the thread() with the parameter doesn't add the output of the new created ThreadDefinition which is definitely wrong.

I created a JIRA and will submit a quick fix for it.
mikek753

Posts: 15
Registered: 09/03/10
Re: How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 17, 2012 6:35 AM   in response to: njiang in response to: njiang
 
  Click to reply to this thread Reply
thank you.
looking forward for extra methods
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 17, 2012 12:43 PM   in response to: mikek753 in response to: mikek753
Correct
  Click to reply to this thread Reply
There is methods to do this already
from("direct:foo")
                    // using the builder style
                    .threads().poolSize(5).maxPoolSize(10).threadName("myPool")
                    .to("mock:result");
mikek753

Posts: 15
Registered: 09/03/10
Re: How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 18, 2012 12:55 AM   in response to: davsclaus in response to: davsclaus
 
  Click to reply to this thread Reply
yes, it works - thanks.

Any reasons this new Name isn't shown in JConsole / JMX under Camel Pools?
It's shown as threads# and only Policy name attribute is shown as that set Name.

I see that new name is appended Ok in YourKit and in Eclipse Debugger.
njiang

Posts: 572
Registered: 09/17/07
Re: How to setThreadName() for .threads() in routeBuilder?
Posted: Aug 18, 2012 7:35 AM   in response to: mikek753 in response to: mikek753
 
  Click to reply to this thread Reply
what kind of the camel thread pool that you are using?
Maybe you can send us a picture of your JMX console.