|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ThreadService
Interface for the thread handling service.
| Method Summary | ||
|---|---|---|
Thread |
getParent(Thread thread)
Returns the thread that called the specified thread. |
|
void |
invoke(Runnable code)
Executes the given code in a special dispatch thread, blocking until execution is complete. |
|
boolean |
isDispatchThread()
Gets whether the current thread is a dispatch thread for use with invoke(java.lang.Runnable) and queue(java.lang.Runnable). |
|
void |
queue(Runnable code)
Queues the given code for later execution in a special dispatch thread. |
|
|
run(Callable<V> code)
Asynchronously executes the given code in a new thread, as decided by the thread service. |
|
Future<?> |
run(Runnable code)
Asynchronously executes the given code in a new thread, as decided by the thread service. |
|
| Methods inherited from interface org.scijava.service.Service |
|---|
initialize, registerEventHandlers |
| Methods inherited from interface org.scijava.Contextual |
|---|
context, getContext, setContext |
| Methods inherited from interface org.scijava.Prioritized |
|---|
getPriority, setPriority |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Methods inherited from interface org.scijava.plugin.HasPluginInfo |
|---|
getInfo, setInfo |
| Methods inherited from interface org.scijava.Disposable |
|---|
dispose |
| Methods inherited from interface java.util.concurrent.ThreadFactory |
|---|
newThread |
| Method Detail |
|---|
<V> Future<V> run(Callable<V> code)
code - The code to execute.
Future that will contain the result once the execution
has finished. Call Future.get() to access to the return
value (which will block until execution has completed).Future<?> run(Runnable code)
code - The code to execute.
Future that can be used to block until the execution has
finished. Call Future.get() to do so.boolean isDispatchThread()
invoke(java.lang.Runnable) and queue(java.lang.Runnable).
In the case of AWT-based applications (e.g., Java on the desktop), this is typically the AWT Event Dispatch Thread (EDT). However, ultimately the behavior is implementation-dependent.
void invoke(Runnable code)
throws InterruptedException,
InvocationTargetException
In the case of AWT-based applications (e.g., Java on the desktop), this is typically the AWT Event Dispatch Thread (EDT). However, ultimately the behavior is implementation-dependent.
code - The code to execute.
InterruptedException - If the code execution is interrupted.
InvocationTargetException - If an uncaught exception occurs in the
code during execution.void queue(Runnable code)
In the case of AWT-based applications (e.g., Java on the desktop), this is typically the AWT Event Dispatch Thread (EDT). However, ultimately the behavior is implementation-dependent.
code - The code to execute.Thread getParent(Thread thread)
This works only on threads which the thread service knows about, of course.
thread - the managed thread, null refers to the current thread
ThreadService to spawn the specified thread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||