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 class
ThreadUtil.RefreshType
-
Constructor Summary
Constructors Constructor Description ThreadUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
asyncStop(String... names)
static AsyncRun
createAsync(String name, Consumer<Long> consumer)
static AsyncRun
createLoop(String name, long refreshMs, Consumer<Long> consumer)
static boolean
isEmpty(String string)
static AsyncRun
loop(String name)
protected AsyncRun
loop(String name, long refreshMs, Consumer<Long> consumer)
protected AsyncRun
loop(String name, ThreadUtil.RefreshType refreshType, Consumer<Long> consumer)
protected AsyncRun
loop(String name, Consumer<Long> consumer)
static void
sleep(long milliSeconds)
static boolean
waitFor(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
-
-