Package graphql.util

Class LockKit.ReentrantLock

  • Enclosing class:
    LockKit

    public static class LockKit.ReentrantLock
    extends java.lang.Object
    A class to run code inside a reentrant lock
    • Constructor Summary

      Constructors 
      Constructor Description
      ReentrantLock()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <E> E callLocked​(java.util.function.Supplier<E> codeToRun)  
      void lock()
      Sometimes you need to directly lock things like for checked exceptions
      void runLocked​(java.lang.Runnable codeToRun)  
      void unlock()  
      • Methods inherited from class java.lang.Object

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

      • ReentrantLock

        public ReentrantLock()
    • Method Detail

      • lock

        public void lock()
        Sometimes you need to directly lock things like for checked exceptions

        It's on you to unlock it!

      • unlock

        public void unlock()
      • runLocked

        public void runLocked​(java.lang.Runnable codeToRun)
      • callLocked

        public <E> E callLocked​(java.util.function.Supplier<E> codeToRun)