Module life.expert

Class ThreadUtils


  • public final class ThreadUtils
    extends java.lang.Object
    - contains methods that wrap (as an optional type) lambdas with checked exceptions - contains the methods of custom configured Executors for passing them to the Flux input - and some general purpose thread delay method
    • Method Detail

      • delay

        public static void delay​(long second)
        Delay.
        Parameters:
        second - the second
      • executorDaemon

        public static java.util.concurrent.Executor executorDaemon​(java.lang.String name,
                                                                   int size,
                                                                   int waitTimeRatio)
        Executor executor.
        Parameters:
        name - the name
        size - the size
        waitTimeRatio - the wait time ratio
        Returns:
        the executor
      • executorDaemon

        public static java.util.concurrent.Executor executorDaemon​(int size,
                                                                   int waitTimeRatio)
        Executor daemon executor.
        Parameters:
        size - the size
        waitTimeRatio - the wait time ratio
        Returns:
        the executor
      • executorForWaitingTasks

        public static java.util.concurrent.Executor executorForWaitingTasks​(int size)
        Executor executor.
        Parameters:
        size - the size
        Returns:
        the executor
      • executorCustom

        public static java.util.concurrent.Executor executorCustom​(java.lang.String name,
                                                                   int size)
        Executor custom executor.
        Parameters:
        name - the name
        size - the size
        Returns:
        the executor
      • interruptedWrapper

        public static void interruptedWrapper​(RunnableInterrupted operation)
        Io wrapper.
        Parameters:
        operation - the operation
      • interruptedWrapper

        public static <E> E interruptedWrapper​(SupplierInterrupted<E> operation)
        Io wrapper e.
        Type Parameters:
        E - the type parameter
        Parameters:
        operation - the operation
        Returns:
        the e
      • interruptedOptional

        public static <E> java.util.Optional<E> interruptedOptional​(SupplierInterrupted<E> operation)
        Io optional optional.
        Type Parameters:
        E - the type parameter
        Parameters:
        operation - the operation
        Returns:
        the optional
      • interruptedWrapper

        public static <E> void interruptedWrapper​(E input,
                                                  ConsumerInterrupted<E> operation)
        Io wrapper.
        Type Parameters:
        E - the type parameter
        Parameters:
        input - the input
        operation - the operation