Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable thread names for JolokiaServer/JolokiaServerConfig #367

Open
mjustin opened this Issue Jan 6, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@mjustin
Copy link

mjustin commented Jan 6, 2018

It would be useful to be able to configure the thread names of threads created by the Jolokia server. That way if the application is logging thread names, it'll be obvious which threads were from Jolokia server requests. For instance, in my app I might want to have the threads named "jolokia-1", "jolokia-2", ... instead of the Java default "Thread-1", "Thread-2", ...

This could be solved by adding a "threadNamePrefix" or "threadNameFormat" option to the JolokiaServerConfig.

Alternatively, if there was a way to specify the Executor or ThreadFactory used by the the HttpServer, the user could customize it to set whatever name they wanted.

The current workaround to achieve this is to create a JolokiaServer with a manually created HttpServer, rather than letting Jolokia create the server. In addition to the additional code and potential inconsistency of manually configuring an HttpServer, it also means that it cannot be used with jolokia-spring's SpringJolokiaAgent, as that uses the default server created by JolokiaServer.

Example of APIs in other frameworks that have this sort of behavior:

@rhuss

This comment has been minimized.

Copy link
Owner

rhuss commented Jan 10, 2018

Sound like a very good idea. Fancy for doing a PR ? (i'm a bit loaded these days)

@mjustin

This comment has been minimized.

Copy link
Author

mjustin commented Jan 12, 2018

If I do just one of those options, I'm thinking "threadNamePrefix" as it's the most straightforward to implement. Sound reasonable?

@rhuss

This comment has been minimized.

Copy link
Owner

rhuss commented Jan 13, 2018

"threadNamePrefix" sounds fine to me.

@mjustin

This comment has been minimized.

Copy link
Author

mjustin commented Mar 19, 2018

I have since switched to a different project that does not use Jolokia. It will therefore be unlikely that I will find the time to make this improvement in the near future.

nevenr added a commit to nevenr/jolokia that referenced this issue Jun 30, 2018

nevenr added a commit to nevenr/jolokia that referenced this issue Jul 1, 2018

nevenr added a commit to nevenr/jolokia that referenced this issue Jul 2, 2018

rhuss added a commit that referenced this issue Jul 5, 2018

Merge pull request #384 from nevenr/CustomizableThreadNamesForJolokia…
…Server-367

Customizable thread names for JolokiaServer/JolokiaServerConfig #367
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.