Class BlockHoundHelper


  • public class BlockHoundHelper
    extends Object
    • Method Detail

      • currentThreadRequiresNonBlocking

        public static boolean currentThreadRequiresNonBlocking()
        Returns true if the current thread at this time requires all invocations to be non blocking
      • ensureNonBlocking

        public static <V> V ensureNonBlocking​(Supplier<V> supplier)
        Invokes the provided Supplier in a scope that guarantees that the current thread is not blocked. If blocking is found the invoking test will fail.
      • ensureNonBlocking

        public static void ensureNonBlocking​(Runnable runnable)
        Invokes the provided Runnable in a scope that guarantees that the current thread is not blocked. If blocking is found the invoking test will fail.
      • allowBlocking

        public static void allowBlocking​(Runnable runnable)
      • ensureNonBlockingExecutor

        public static Executor ensureNonBlockingExecutor()
        Returns an Executor that when supplied a task, will guarantee that task does not block when invoked. If the task does block it will fail the invoking test.
      • allowBlockingExecutor

        public static Executor allowBlockingExecutor()
        Returns an Executor that when supplied a task, will allow it to invoke blocking calls, even if the invoking context was already registered as non blocking. Useful to mock submission to a blocking executor.