Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code that uses this lock behaves similar to synchronized code that uses the traditional monitor lock. In addition, it provides several other capabilities, for instance, the tryLock() method does not block waiting if another thread is already holding the lock. The class java.util.concurrent.locks.ReentrantReadWriteLock can be used when a thread requires a lock to write information while other threads require the lock to simultaneously read the information.

Noncompliant Code Example (AtomicReference)

...