java.lang.Object
org.apache.jena.atlas.lib.ThreadLib
Misc class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRun asynchronously on another thread; the thread has started when this function returns.static <V> VcallWithAfter(Supplier<V> action, Runnable after) Execute and return a value; always call the "after" runnablestatic <V> VcallWithBeforeAfter(Supplier<V> action, Runnable before, Runnable after) Execute.static <V> VcallWithLock(Lock lock, Supplier<V> r) Run inside a Lockstatic ExecutorServicestatic <T> TsyncCallThread(Supplier<T> r) Run synchronously but on another thread.static voidRun synchronously but on another thread.static voidExecute; always call the "after" runnablestatic voidwithBeforeAfter(Runnable action, Runnable before, Runnable after) Execute.static voidRun inside a Lock
-
Constructor Details
-
ThreadLib
public ThreadLib()
-
-
Method Details
-
getExecutionService
-
async
Run asynchronously on another thread; the thread has started when this function returns. -
syncOtherThread
Run synchronously but on another thread. -
syncCallThread
Run synchronously but on another thread. -
withBeforeAfter
Execute. Perform the "before" action, then main action. Always call the "after" runnable if the "before" succeeded. Be careful about argument order.- Parameters:
action-before-after-
-
callWithBeforeAfter
Execute. Perform the "before" action, then main action. Always call the "after" runnable if the "before" succeeded. Be careful about argument order.- Parameters:
action-before-after-
-
withAfter
Execute; always call the "after" runnable -
callWithAfter
Execute and return a value; always call the "after" runnable -
callWithLock
Run inside a Lock -
withLock
Run inside a Lock
-