Class Mutex


  • public class Mutex
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Mutex​(boolean initiallyPermitted)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void await()
      Wait for a release().
      void awaitOrTimeout​(long timeout, java.util.concurrent.TimeUnit unit)
      Wait for a release() with a timeout.
      void release()
      Release the Mutex.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Mutex

        public Mutex​(boolean initiallyPermitted)
    • Method Detail

      • await

        public void await()
                   throws java.lang.InterruptedException
        Wait for a release().
        Throws:
        java.lang.InterruptedException - on wait error
      • awaitOrTimeout

        public void awaitOrTimeout​(long timeout,
                                   java.util.concurrent.TimeUnit unit)
                            throws java.lang.InterruptedException
        Wait for a release() with a timeout.
        Parameters:
        timeout - the timeout value
        unit - the timeout TimeUnit
        Throws:
        java.lang.InterruptedException - on wait error
      • release

        public void release()
        Release the Mutex.