Skip to content

JAVA-1275: Use Netty's default thread factory#734

Merged
olim7t merged 1 commit into
3.0.xfrom
java1275
Sep 12, 2016
Merged

JAVA-1275: Use Netty's default thread factory#734
olim7t merged 1 commit into
3.0.xfrom
java1275

Conversation

@olim7t
Copy link
Copy Markdown
Contributor

@olim7t olim7t commented Aug 31, 2016

This makes all of our threads instances of Netty's
FastThreadLocalThread, which allows an optimization of ThreadLocal
variables.

@olim7t olim7t added this to the 3.0.4 milestone Aug 31, 2016

ThreadFactory threadFactory(String name) {
return new ThreadFactoryBuilder().setNameFormat(clusterName + "-" + name + "-%d").build();
return new ThreadFactoryBuilder()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we use:

return new DefaultThreadFactory(clusterName + "-" + name);

Although I noticed that this gives a slightly different name, i.e.: cluster1-nio-worker-7-1 instead of cluster1-nio-worker-1 since it seems to assign a unique pool id to each thread factory, so maybe the way it is done here is best for compatibility with the existing naming (also that unique id seems extraneous since we're sort of doing that ourselves with the cluster name).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, keeping the exact same naming was my motivation here.

This makes all of our threads instances of Netty's
FastThreadLocalThread, which allows an optimization of ThreadLocal
variables.
@olim7t olim7t merged commit d90f192 into 3.0.x Sep 12, 2016
@olim7t olim7t deleted the java1275 branch September 12, 2016 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants