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

Mention Thread.Builder in ThreadFactoryBuilders javadocs #7427

Closed
3 tasks done
bjmi opened this issue Oct 10, 2024 · 9 comments
Closed
3 tasks done

Mention Thread.Builder in ThreadFactoryBuilders javadocs #7427

bjmi opened this issue Oct 10, 2024 · 9 comments
Assignees

Comments

@bjmi
Copy link

bjmi commented Oct 10, 2024

API(s)

com.google.common.util.concurrent.ThreadFactoryBuilder

How do you want it to be improved?

Just as you can assign the the starting value of the counter for a Thread Builder / ThreadFactory (java.lang.Thread.Builder.name(String prefix, long start)),
you should also be able to assign the start value for Guava's com.google.common.util.concurrent.ThreadFactoryBuilder.

How about adding the following overload ThreadFactoryBuilder.setNameFormat(String nameFormat, long start)?

Checklist

@bjmi bjmi added the type=enhancement Make an existing feature better label Oct 10, 2024
@xc-x
Copy link

xc-x commented Oct 10, 2024

Hi I would like to complete this issue. Can you plz assign it to me?

@u7683345
Copy link

I am new to open source and think I know how to solve this. Can I get assigned? Thanks!
-Andrew
@bjmi

@MsSteph74
Copy link

MsSteph74 commented Oct 11, 2024 via email

@kluever
Copy link
Member

kluever commented Oct 11, 2024

Is there any reason you can't use the Thread.Builder API in Java 21? I think that mostly obsoletes our ThreadFactoryBuilder API.

@netdpb
Copy link
Member

netdpb commented Oct 11, 2024

Hi @xc-x and @u7683345. Thanks for your interest in helping here. We're still not sure whether we want to add this feature at all. If we do decide to add it, we might be able to use your help.

@bjmi
Copy link
Author

bjmi commented Oct 12, 2024

Is there any reason you can't use the Thread.Builder API in Java 21? I think that mostly obsoletes our ThreadFactoryBuilder API.

That's right. Then this request will benefit those who do not yet have Java 21 in use.

@kluever
Copy link
Member

kluever commented Oct 12, 2024

In general, we don't add features just for parity with JDK releases. If you have a compelling use case, we can discuss it, but the fact that it's been 14 years since this was created, and nobody has asked for it, makes me hesitant. The ID number is fairly arbitrary, and just meant to be a unique name to identify the thread. Why do you care if the numbering starts at 0 or 999 or whatever?

@bjmi
Copy link
Author

bjmi commented Oct 12, 2024

We mainly use setDaemon and setNameFormat of the ThreadFactoryBuilder and both are supported by JDK Thread.Builder.
We will follow the suggestion and switch to the JDK variant and makes this issue obsolete.
Then, a reference to the JDK counterpart in the Javadoc would be helpful.

@kluever
Copy link
Member

kluever commented Oct 14, 2024

Closing for now...happy to re-evaluate if someone has a strong use case for caring about the # that the thread name starts at.

@kluever kluever closed this as completed Oct 14, 2024
@kluever kluever self-assigned this Oct 14, 2024
@kluever kluever reopened this Oct 14, 2024
@kluever kluever changed the title Set start value for ThreadFactoryBuilder.nameFormat Mention Thread.Builder in ThreadFactoryBuilders javadocs Oct 14, 2024
@kluever kluever added type=api-docs Change/add API documentation and removed type=enhancement Make an existing feature better labels Oct 14, 2024
copybara-service bot pushed a commit that referenced this issue Oct 14, 2024
RELNOTES=n/a
PiperOrigin-RevId: 685850557
copybara-service bot pushed a commit that referenced this issue Oct 14, 2024
RELNOTES=n/a
PiperOrigin-RevId: 685860825
@kluever kluever closed this as completed Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants