-
Notifications
You must be signed in to change notification settings - Fork 50
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
Remove usages of Unsafe
#215
base: main
Are you sure you want to change the base?
Conversation
} catch (NoSuchFieldException e) { | ||
throw new NoSuchFieldError(e.getMessage()); | ||
} | ||
} | ||
|
||
static void run() { | ||
final Thread thread = Thread.currentThread(); | ||
JBossExecutors.unsafe.putObject(thread, threadLocalMapOffs, null); | ||
JBossExecutors.unsafe.putObject(thread, inheritableThreadLocalMapOffs, null); | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We gotta ask @galderz how this perform in native
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect it to be OK: AFAIK, VarHandle is using these method handles internally, and we're acquiring them in static init. My expectation is that the calls will be inlined.
However, either way it's not going to work without --add-opens java.base/java.lang=org.jboss.threads
or ...=ALL-UNNAMED
. That's the real sticky part.
3ccbcaa
to
6b81015
Compare
The main outstanding problem here is that we need a |
Updated so that we continue to use |
This now just needs:
|
Remove all usages of
Unsafe
in favor of supported APIs.To use the thread-local resetter will now require
--add-opens java.base/java.lang=org.jboss.threads
(orALL-UNNAMED
if not using JDK modules).Java 25+ reports this: