- java.lang.Object
-
- life.expert.common.async.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 Summary
Modifier and Type Method Description static voiddelay(long second)Delay.static java.util.concurrent.ExecutorexecutorCustom(java.lang.String name, int size)Executor custom executor.static java.util.concurrent.ExecutorexecutorDaemon(int size, int waitTimeRatio)Executor daemon executor.static java.util.concurrent.ExecutorexecutorDaemon(java.lang.String name, int size, int waitTimeRatio)Executor executor.static java.util.concurrent.ExecutorexecutorForWaitingTasks(int size)Executor executor.static <E> java.util.Optional<E>interruptedOptional(SupplierInterrupted<E> operation)Io optional optional.static <E> voidinterruptedWrapper(E input, ConsumerInterrupted<E> operation)Io wrapper.static voidinterruptedWrapper(RunnableInterrupted operation)Io wrapper.static <E> EinterruptedWrapper(SupplierInterrupted<E> operation)Io wrapper e.
-
-
-
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 namesize- the sizewaitTimeRatio- 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 sizewaitTimeRatio- 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 namesize- 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 inputoperation- the operation
-
-