Interface ReadWriteMutex

  • All Known Implementing Classes:
    ReentrantReadWriteMutex

    public interface ReadWriteMutex
    Interface for wrapping a read-write muted into java-8 functional interface.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void lockForReading​(java.lang.Runnable callable)
      Lock the config for a read operation that must be read atomic.
      <V> V lockForReading​(java.util.function.Supplier<V> callable)
      Lock the config for a read operation that must be read atomic.
      void lockForWriting​(java.lang.Runnable callable)
      Lock the config for a write operation that must be write atomic, and could interfere with read operations.
      <V> V lockForWriting​(java.util.function.Supplier<V> callable)
      Lock the config for a write operation that must be write atomic, and could interfere with read operations.
    • Method Detail

      • lockForReading

        void lockForReading​(java.lang.Runnable callable)
        Lock the config for a read operation that must be read atomic.
        Parameters:
        callable - The callable operation.
      • lockForReading

        <V> V lockForReading​(java.util.function.Supplier<V> callable)
        Lock the config for a read operation that must be read atomic.
        Type Parameters:
        V - The read return value type.
        Parameters:
        callable - The enclosed callable to be run inside read lock.
        Returns:
        The supplied value.
      • lockForWriting

        void lockForWriting​(java.lang.Runnable callable)
        Lock the config for a write operation that must be write atomic, and could interfere with read operations.
        Parameters:
        callable - The callable operation.
      • lockForWriting

        <V> V lockForWriting​(java.util.function.Supplier<V> callable)
        Lock the config for a write operation that must be write atomic, and could interfere with read operations.
        Type Parameters:
        V - The write return value type.
        Parameters:
        callable - The callable operation.
        Returns:
        The supplied value.