Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2010-09-27 23:27:18 +0000
committerPawel Piech2010-09-27 23:27:18 +0000
commitc72c78d35cbde865ba396befa1e816d7eb710a1d (patch)
tree7572f8a56315f30545923a695e11ffa67dc356cf /dsf/org.eclipse.cdt.dsf
parentb2dd37899a837f58ec785aa70c1c04efeac2b297 (diff)
downloadorg.eclipse.cdt-c72c78d35cbde865ba396befa1e816d7eb710a1d.tar.gz
org.eclipse.cdt-c72c78d35cbde865ba396befa1e816d7eb710a1d.tar.xz
org.eclipse.cdt-c72c78d35cbde865ba396befa1e816d7eb710a1d.zip
Bug 325943 - [concurrent] Robustify Sequence against RejectedExecutionException
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java37
1 files changed, 28 insertions, 9 deletions
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java
index da0f4f1913e..79c868780a8 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Sequence.java
@@ -421,10 +421,19 @@ abstract public class Sequence extends DsfRunnable implements Future<Object> {
@Override
protected void handleErrorOrWarning() {
- abortExecution(getStatus());
+ abortExecution(getStatus(), true);
};
@Override
+ protected void handleRejectedExecutionException() {
+ abortExecution(
+ new Status(IStatus.ERROR, DsfPlugin.PLUGIN_ID, 0,
+ "Executor shut down while executing Sequence " + this + ", step #" + fCurrentStepIdx, //$NON-NLS-1$ //$NON-NLS-2$
+ null),
+ false);
+ }
+
+ @Override
public String toString() {
return "Sequence \"" + fTaskName + "\", result for executing step #" + fStepIdx + " = " + getStatus(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -450,10 +459,11 @@ abstract public class Sequence extends DsfRunnable implements Future<Object> {
* when the execute submits other runnables, and the other runnables
* encounter the exception.
*/
- abortExecution(new Status(
- IStatus.ERROR, DsfPlugin.PLUGIN_ID, 0,
- "Unhandled exception when executing Sequence " + this + ", step #" + fCurrentStepIdx, //$NON-NLS-1$ //$NON-NLS-2$
- t));
+ abortExecution(
+ new Status(IStatus.ERROR, DsfPlugin.PLUGIN_ID, 0,
+ "Unhandled exception when executing Sequence " + this + ", step #" + fCurrentStepIdx, //$NON-NLS-1$ //$NON-NLS-2$
+ t),
+ true);
/*
* Since we caught the exception, it will not be logged by
@@ -548,8 +558,13 @@ abstract public class Sequence extends DsfRunnable implements Future<Object> {
/**
* Tells the sequence that its execution is to be aborted and it
* should start rolling back the sequence as if it was cancelled by user.
+ *
+ * @param status Status to use for reporting the error.
+ * @param rollBack Whether to start rolling back the sequence after abort.
+ * If this parameter is <code>false</code> then the sequence will also
+ * finish.
*/
- private void abortExecution(final IStatus error) {
+ private void abortExecution(final IStatus error, boolean rollBack) {
if (fRollbackTaskName != null) {
fProgressMonitor.subTask(fRollbackTaskName);
}
@@ -558,9 +573,13 @@ abstract public class Sequence extends DsfRunnable implements Future<Object> {
fRequestMonitor.setStatus(error);
}
fSync.doAbort(new CoreException(error));
-
- // Roll back starting with previous step, since current step failed.
- rollBackStep(fCurrentStepIdx - 1);
+
+ if (rollBack) {
+ // Roll back starting with previous step, since current step failed.
+ rollBackStep(fCurrentStepIdx - 1);
+ } else {
+ finish();
+ }
}
/**

Back to the top