I was just trying to understand optimistic and pessimistic locking mechanisms and came across the definition of them at https://en.wikipedia.org/wiki/Lock_(database)
If I try to relate the concepts to java instead of a database, am I right in saying that a synchronized usage is always pessimistic and a CAS (AtomicInteger
and other classes) usage is always optimistic?