public class ThreadLib extends Object
| Constructor and Description |
|---|
ThreadLib() |
| Modifier and Type | Method and Description |
|---|---|
static void |
async(Runnable r)
Run asynchronously on another thread; the thread has started
when this function returns.
|
static <V> V |
callWithAfter(Supplier<V> action,
Runnable after)
Execute and return a value; always call the "after" runnable
|
static <V> V |
callWithBeforeAfter(Supplier<V> action,
Runnable before,
Runnable after)
Execute.
|
static <V> V |
callWithLock(Lock lock,
Supplier<V> r)
Run inside a Lock
|
static <T> T |
syncCallThread(Supplier<T> r)
Run synchronously but on another thread.
|
static void |
syncOtherThread(Runnable r)
Run synchronously but on another thread.
|
static void |
withAfter(Runnable action,
Runnable after)
Execute; always call the "after" runnable
|
static void |
withBeforeAfter(Runnable action,
Runnable before,
Runnable after)
Execute.
|
static void |
withLock(Lock lock,
Runnable r)
Run inside a Lock
|
public static void async(Runnable r)
public static void syncOtherThread(Runnable r)
public static <T> T syncCallThread(Supplier<T> r)
public static void withBeforeAfter(Runnable action, Runnable before, Runnable after)
action - before - after - public static <V> V callWithBeforeAfter(Supplier<V> action, Runnable before, Runnable after)
action - before - after - public static void withAfter(Runnable action, Runnable after)
public static <V> V callWithAfter(Supplier<V> action, Runnable after)
Licenced under the Apache License, Version 2.0