Soneone told me that AtomicInteger is implemented using JNI, so it is much faster than synchonization. Is this true?
It is unlikely to be implemented based on JNI as this would imply significant overhead. Last time I looked the OpenJDK implementation is based on methods in sun.misc.Unsafe which are mostly implemented as JVM primitives (method calls that are implemented specially with native code in the JVM).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With