Class SingleLock

  • All Implemented Interfaces:
    java.lang.AutoCloseable, ResourceLock

    class SingleLock
    extends java.lang.Object
    implements ResourceLock
    Since:
    1.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.locks.Lock lock  
    • Constructor Summary

      Constructors 
      Constructor Description
      SingleLock​(java.util.concurrent.locks.Lock lock)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ResourceLock acquire()
      Acquire this resource lock, potentially blocking.
      (package private) java.util.concurrent.locks.Lock getLock()  
      void release()
      Release this resource lock.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.junit.platform.engine.support.hierarchical.ResourceLock

        close
    • Field Detail

      • lock

        private final java.util.concurrent.locks.Lock lock
    • Constructor Detail

      • SingleLock

        SingleLock​(java.util.concurrent.locks.Lock lock)
    • Method Detail

      • getLock

        java.util.concurrent.locks.Lock getLock()
      • acquire

        public ResourceLock acquire()
                             throws java.lang.InterruptedException
        Description copied from interface: ResourceLock
        Acquire this resource lock, potentially blocking.
        Specified by:
        acquire in interface ResourceLock
        Returns:
        this lock so it can easily be used in a try-with-resources statement.
        Throws:
        java.lang.InterruptedException - if the calling thread is interrupted while waiting to acquire this lock
      • release

        public void release()
        Description copied from interface: ResourceLock
        Release this resource lock.
        Specified by:
        release in interface ResourceLock