Package org.lsst.ccs

Class ConfigurationService.ConfigurationLock

java.lang.Object
org.lsst.ccs.ConfigurationService.ConfigurationLock
All Implemented Interfaces:
AutoCloseable
Enclosing class:
ConfigurationService

public class ConfigurationService.ConfigurationLock extends Object implements AutoCloseable
Encapsulates a reader lock on the subsystem configuration. An active reader lock will prevent the granting of non-recursive writer locks but will allow more reader locks to be granted. When a writer lock is active then no reader locks or further non-recursive write locks will be granted until the writer lock is released. A writer lock will not be granted until all reader locks are released.

Where possible call the constructor using a try-with-resources statement so that the lock will be released automatically when that statement is exited. Otherwise an explicit call to close() will be required to release the lock.

  • Field Details

    • readLock

      public final Lock readLock
  • Method Details

    • close

      public void close()
      Releases the configuration lock;
      Specified by:
      close in interface AutoCloseable