Class ThreadUtil
- java.lang.Object
-
- berlin.yuna.tinkerforgesensor.util.ThreadUtil
-
public class ThreadUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThreadUtil.RefreshType
-
Constructor Summary
Constructors Constructor Description ThreadUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanasyncStop(String... names)static AsyncRuncreateAsync(String name, Consumer<Long> consumer)static AsyncRuncreateLoop(String name, long refreshMs, Consumer<Long> consumer)static booleanisEmpty(String string)static AsyncRunloop(String name)protected AsyncRunloop(String name, long refreshMs, Consumer<Long> consumer)protected AsyncRunloop(String name, ThreadUtil.RefreshType refreshType, Consumer<Long> consumer)protected AsyncRunloop(String name, Consumer<Long> consumer)static voidsleep(long milliSeconds)static booleanwaitFor(int timeoutMs, BooleanSupplier actual)static <X extends Throwable>
booleanwaitFor(int timeoutMs, BooleanSupplier actual, Supplier<? extends X> throwable)
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String string)
- Parameters:
string- to check on- Returns:
- true if string is null or empty otherwise false
-
loop
protected AsyncRun loop(String name, ThreadUtil.RefreshType refreshType, Consumer<Long> consumer)
-
asyncStop
public static boolean asyncStop(String... names)
-
sleep
public static void sleep(long milliSeconds)
-
waitFor
public static boolean waitFor(int timeoutMs, BooleanSupplier actual)
-
waitFor
public static <X extends Throwable> boolean waitFor(int timeoutMs, BooleanSupplier actual, Supplier<? extends X> throwable) throws X extends Throwable
- Throws:
X extends Throwable
-
-