public abstract class ImagingTask extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
long |
latestExecutionTime |
| Constructor and Description |
|---|
ImagingTask()
For serialization.
|
ImagingTask(String name,
int loggingId)
Creates a new instance of ImagingTask.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStatisticsSample(String name,
long value) |
void |
dispose()
Subclasses should release all the allocated resources when this method
is called.
|
boolean |
equals(Object object)
See the comment about uniqueId.
|
void |
execute()
Executes the task.
|
protected <T extends org.imajine.image.op.Operation> |
execute(org.imajine.image.EditableImage image,
T operation,
String operationName)
Executes an operation adding the elapsed time to the statistics.
|
protected org.imajine.image.EditableImage |
execute2(org.imajine.image.EditableImage image,
org.imajine.image.op.Operation operation,
String operationName)
Executes an operation adding the elapsed time to the statistics.
|
protected org.imajine.image.EditableImage |
execute2AndDispose(org.imajine.image.EditableImage image,
org.imajine.image.op.Operation operation,
String operationName)
The same as execute2(), but the operand image is disposed before returning.
|
protected <T extends org.imajine.image.op.Operation> |
executeAndDispose(org.imajine.image.EditableImage image,
T operation,
String operationName)
The same as execute(), but the operand image is disposed before returning.
|
Serializable |
getId()
Returns the unique id of this task.
|
String |
getName()
Returns the name of this task.
|
org.imajine.image.EditableImage |
getResult()
Returns the result of this task.
|
Statistics |
getStatistics()
Returns the statistics collected by this task.
|
Throwable |
getThrowable()
If the task ended with an error, a Throwable is returned by this method.
|
int |
hashCode()
See the comment about uniqueId.
|
boolean |
isRemoteExecutionOk()
If this method return
true (the default), this task can be
executed remotely. |
void |
prepare(ImagingTaskProcessor processor)
This method is performed in a local context before the task is
scheduled to run - that is, this method is performed in a serialized
fashion, possibly on a single computing node (depending on the processing
engine).
|
protected void |
registerTime(String name,
org.imajine.image.EditableImage image)
Updates statistics about execution time, about the latest performed
operation on the given image.
|
protected abstract void |
run()
Concrete implementations should provide the task core in this method.
|
protected void |
setResult(org.imajine.image.EditableImage result) |
void |
setThrowable(Throwable throwable) |
String |
toString() |
public ImagingTask()
public ImagingTask(String name, int loggingId)
prepare() instead.
This constructor must return very quickly.public String getName()
public Serializable getId()
public void prepare(ImagingTaskProcessor processor) throws Exception
processor parameter can be used to query some properties
of the ImagingTaskProcessor that could be used for alternate
preparing strategies.
The super method must be always called.processor - the processorExceptionprotected abstract void run()
throws Exception
Exceptionpublic final org.imajine.image.EditableImage getResult()
protected final void setResult(org.imajine.image.EditableImage result)
public Throwable getThrowable()
public void setThrowable(Throwable throwable)
public boolean isRemoteExecutionOk()
true (the default), this task can be
executed remotely. Otherwise it will be scheduled on the local node.
Usually tasks which computation time is very quick and much shorter than
the overhead to serialize data back and forth should return
false.public Statistics getStatistics()
public void dispose()
public final int hashCode()
public final boolean equals(Object object)
public final void execute()
public void addStatisticsSample(String name, long value)
protected void registerTime(String name, org.imajine.image.EditableImage image)
name - the statistics nameimage - the imageprotected <T extends org.imajine.image.op.Operation> T execute(org.imajine.image.EditableImage image,
T operation,
String operationName)
image - the image to processoperation - the operation to executeoperationName - the name used for the statisticsprotected <T extends org.imajine.image.op.Operation> T executeAndDispose(org.imajine.image.EditableImage image,
T operation,
String operationName)
image - the image to processoperation - the operation to executeoperationName - the name used for the statisticsprotected org.imajine.image.EditableImage execute2(org.imajine.image.EditableImage image,
org.imajine.image.op.Operation operation,
String operationName)
image - the image to processoperation - the operation to executeoperationName - the name used for the statisticsprotected org.imajine.image.EditableImage execute2AndDispose(org.imajine.image.EditableImage image,
org.imajine.image.op.Operation operation,
String operationName)
image - the image to processoperation - the operation to executeoperationName - the name used for the statisticsCopyright © 2003–2014 Tidalwave s.a.s. (http://tidalwave.it). All rights reserved.