Class BlockingWork


  • public class BlockingWork
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void begin()
      Assertion checks to see if the current thread allows blocking work.
      static <E extends java.lang.Throwable>
      void
      invokeBlockingTask​(FragileRunnable<E> runnable)
      Invokes a task that is expected to perform blocking work.
      static void setBlockingWorkAllowed​(boolean allowed)  
      static java.util.concurrent.ThreadFactory wrapThreadFactory​(java.util.concurrent.ThreadFactory delegate)
      Wraps a thread factory to allow blocking work.
      • Methods inherited from class java.lang.Object

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

      • begin

        public static void begin()
        Assertion checks to see if the current thread allows blocking work. Throws if not allowed.
        Throws:
        BlockingWork.NoBlockingWorkAllowedException - if blocking work not allowed on calling thread.
      • setBlockingWorkAllowed

        public static void setBlockingWorkAllowed​(boolean allowed)
      • invokeBlockingTask

        public static <E extends java.lang.Throwable> void invokeBlockingTask​(FragileRunnable<E> runnable)
                                                                       throws E extends java.lang.Throwable
        Invokes a task that is expected to perform blocking work. Leaves the state of the thread's blocking work policy unchanged.
        Throws:
        E extends java.lang.Throwable
      • wrapThreadFactory

        public static java.util.concurrent.ThreadFactory wrapThreadFactory​(java.util.concurrent.ThreadFactory delegate)
        Wraps a thread factory to allow blocking work.