All Known Implementing Classes:
ReentrantJavaReadWriteLock

public interface ReadWriteLock
Facility to execute operations with read and write locks.

Non-reentrant read operations are not allowed until all write operations have been finished. Additionally, a write operation can acquire the read lock, but not vice-versa.

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    read(ValueOperation<T> operation)
    Executes an operation protected by a read lock.
    void
    read(VoidOperation operation)
    Executes an operation protected by a read lock.
    <T> T
    write(ValueOperation<T> operation)
    Executes an operation protected by a write lock.
    void
    write(VoidOperation operation)
    Executes an operation protected by a write lock.
  • Method Details

    • read

      <T> T read(ValueOperation<T> operation)
      Executes an operation protected by a read lock.
      Type Parameters:
      T - the operation's return type
      Parameters:
      operation - the operation to execute
      Returns:
      the operation's result
    • read

      void read(VoidOperation operation)
      Executes an operation protected by a read lock.
      Parameters:
      operation - the operation to execute
    • write

      <T> T write(ValueOperation<T> operation)
      Executes an operation protected by a write lock.
      Type Parameters:
      T - the operation's return type
      Parameters:
      operation - the operation to execute
      Returns:
      the operation's result
    • write

      void write(VoidOperation operation)
      Executes an operation protected by a write lock.
      Parameters:
      operation - the operation to execute