-
Notifications
You must be signed in to change notification settings - Fork 458
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
ChannelAdaptor potentially unsafe synchronization #585
Comments
Also it might throw exceptions in future JVM releases according to the JEP-390 https://openjdk.org/jeps/390
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello everyone,
Skimming through ChannelAdaptor source it seems in this line the disconnectLock is the shared Boolean.TRUE object.
This might be unsafe as someone might inadvertly deadlock the shutdown of a ChannelAdaptor by locking on Boolean.True. Also this would make the lock static in scope given that this lock instance would be shared among all other ChannelAdaptors.
Finally synchronizing against Boolean is warned against by the Java spec as Boolean and a few other java.lang classes are considered ValueBased classes. (See @jdk.internal.ValueBased)
Seems it could be swapped for
new Object()
without any side effect as far as I could see.Probably never harmed anyone but better be safe!
Cheers
The text was updated successfully, but these errors were encountered: