}
}
this.notifier.workflowTerminated();
if (this.mode == GUI_MODE) {
final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
@Override
public void cancel() {
// Do nothing
}
}, "Stop Workflow", "Cleaning up resources for Workflow", this.engine);
new Thread(new Runnable() {
@Override
public void run() {
waitDialog.show();
}
}).start();
// Send Notification for output values
finish();
// Sleep to provide for notification delay
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
cleanup();
waitDialog.hide();
} else {
finish();
}
} catch (RuntimeException e) {
// we reset all the state