AtomicBoolean uses native code for synchronization. How does it translate into java locks?
what's the difference between:
AtomicBoolean a = new AtomicBoolean();
synchronized (a) {
a.set(true);
}
vs:
a.set(true)
I know the synchronized(a) is not needed because a itself will ensure the operation is atomic. But is the lock in synchronized (a) the same lock as in a.set(true) ?