Class Mutex

java.lang.Object
ecmwf.common.technical.Mutex
All Implemented Interfaces:
AutoCloseable

public final class Mutex extends Object implements AutoCloseable
ECMWF Product Data Store (OpenECPDS) Project The Mutex class represents a mutual exclusion lock for a specific key. It has a reference to a Synchronized object, which is used to manage locks on a per-key basis. The lock() method of the Mutex object acquires the lock for the associated key by calling the lock() method of the underlying Synchronized object. The close() method of the Mutex object releases the lock for the associated key by calling the free() method of the underlying Synchronized object. This class provides a way to synchronize access to a shared resource on a per-key basis, which can help prevent data corruption and other synchronization-related problems. *
Since:
2024-07-01
Version:
6.7.7
Author:
Laurent Gougeon invalid input: '<'syi@ecmwf.int>, ECMWF.
  • Constructor Details

    • Mutex

      protected Mutex(Synchronized sync, Object key)
      Instantiates a new mutex.
      Parameters:
      sync - the sync
      key - the key
  • Method Details

    • lock

      public Object lock()
      Lock.
      Returns:
      the object
    • close

      public void close()
      Close.
      Specified by:
      close in interface AutoCloseable