/**
* @see java.lang.Runnable#run()
*/
public void run() {
Task actualTask = wrappedTask.getActualTask();
logger.finest("Starting processing of task: "
+ actualTask.getTaskDescription());
try {
// Process the actual task
actualTask.run();
// Check if task finished with an error
if (actualTask.getStatus() == TaskStatus.ERROR) {
logger.severe("Task error: " + actualTask.getErrorMessage());
String errorMsg = actualTask.getErrorMessage();
if (errorMsg == null)
errorMsg = "Unspecified error";
MZmineCore.getDesktop().displayErrorMessage(
"Error of task " + actualTask.getTaskDescription(),
errorMsg);
}
/*
* This is important to allow the garbage collector to remove the
* task, while keeping the task description in the
* "Tasks in progress" window
*/
wrappedTask.removeTaskReference();
} catch (Throwable e) {
/*
* This should never happen, it means the task did not handle its
* exception properly, or there was some severe error, like
* OutOfMemoryError
*/
logger.log(Level.SEVERE,
"Unhandled exception " + e + " while processing task "
+ actualTask.getTaskDescription(), e);
e.printStackTrace();
MZmineCore.getDesktop().displayErrorMessage(
"Unhandled exception in task "
+ actualTask.getTaskDescription() + ": "
+ ExceptionUtils.exceptionToString(e));
}
/*