Class ZLock

All Implemented Interfaces:
Serializable, ReadWriteLock

public final class ZLock
extends ReentrantReadWriteLock
An implementation of ReentrantReadWriteLock with an easier read-write lock mechanism.
See Also:
Serialized Form
  • Constructor Details

    • ZLock

      public ZLock()
      Creates a new lock with default (nonfair) ordering properties.
    • ZLock

      public ZLock​(boolean fair)
      Creates a new lock with the given fairness policy.
      Parameters:
      fair - true if this lock should use a fair ordering policy.
  • Method Details

    • lockRead

      public void lockRead()
      Locks this lock for reading.
    • unlockRead

      public void unlockRead()
      Unlocks this lock after being locked for reading.
    • lockWrite

      public void lockWrite()
      Locks this lock for writing.
    • unlockWrite

      public void unlockWrite()
      Unlock this lock after being locked for writing.