public abstract class Worker extends Object implements Runnable
Modifier and Type | Class and Description |
---|---|
static class |
Worker.Task
A class that calls run() wrapped properly for task monitoring;
Create it like this:
Bureaucrat b = Bureaucrat.createAndStart(new Worker.Task("Title") { public void exec() {
doSomething();
doSomethingElse();
}}, project);
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
quit |
protected Object |
result
Extending classes may store a resulting piece of data.
|
Constructor and Description |
---|
Worker(String task_name) |
Worker(String task_name,
boolean headless_mode) |
Worker(String task_name,
boolean headless_mode,
boolean interrupt_on_quit) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
When quitted or interrupted, executes this method once.
|
protected void |
finishedWorking() |
Object |
getProperty(Object key) |
Object |
getResult()
Returns data generated by the worker, or null if none was set.
|
String |
getTaskName() |
String |
getThreadName() |
boolean |
hasQuitted() |
boolean |
hasStarted() |
boolean |
isWorking() |
void |
join() |
boolean |
onBackground()
Whether the work is done on the background, without need to bring ImageJ toolbar to front for instance.
|
void |
quit()
If interrupt_on_quit, then it will call thread.getThreadGroup().interrupt() to set a quit flag to each child thread.
|
protected void |
setAsBackground(boolean b) |
void |
setPriority(int priority) |
void |
setProperty(Object key,
Object value) |
void |
setTaskName(String name) |
protected void |
startedWorking() |
protected volatile boolean quit
protected Object result
public Worker(String task_name)
public Worker(String task_name, boolean headless_mode)
public Worker(String task_name, boolean headless_mode, boolean interrupt_on_quit)
public void setTaskName(String name)
protected void startedWorking()
public boolean hasStarted()
protected void finishedWorking()
public boolean isWorking()
public String getTaskName()
public String getThreadName()
public void setPriority(int priority)
public void quit()
public void join() throws InterruptedException
InterruptedException
public boolean hasQuitted()
protected void setAsBackground(boolean b)
public boolean onBackground()
public void cleanup()
public Object getResult()
Copyright © 2015–2021 Fiji. All rights reserved.