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

inheritableThreadLocals won't be accessible under Java 9 #2723

Closed
cpovirk opened this issue Jan 23, 2017 · 1 comment
Closed

inheritableThreadLocals won't be accessible under Java 9 #2723

cpovirk opened this issue Jan 23, 2017 · 1 comment
Assignees

Comments

@cpovirk
Copy link
Member

cpovirk commented Jan 23, 2017

#2571 (comment)

We access it here:

Field inheritableThreadLocals = Thread.class.getDeclaredField("inheritableThreadLocals");

@eamonnmcmanus
Copy link
Member

As pointed out in a discussion between @chrisseaton and @headius, there is a new constructor for java.lang.Thread that says whether or not InheritableThreadLocals should actually be inherited. So we could potentially use that via reflection if we detect it is present, instead of the hack here that zaps the InheritableThreadLocals after the thread has been created. My main concern is that someone might decide that five constructor parameters are not enough and add another one before the Java 9 API goes final. But I think it's late enough in the Java 9 lifecycle for that to be unlikely.

@cpovirk cpovirk closed this as completed in 2927518 Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants