From c60f80ccc0cc1e5e0ae333ea84b7cd458fab988c Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Thu, 27 Mar 2008 16:18:04 +0000 Subject: [PATCH] [179293] Further refactoring of the handle*() methods of the RequestMoniotr. --- .../dd/dsf/concurrent/RequestMonitor.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/RequestMonitor.java b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/RequestMonitor.java index 8219ae9201e..c8d6ce4385d 100644 --- a/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/RequestMonitor.java +++ b/plugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/concurrent/RequestMonitor.java @@ -163,9 +163,12 @@ public class RequestMonitor { public void cancel() { Object[] listeners = null; synchronized (this) { - fCanceled = true; - if (fCancelListeners != null) { - listeners = fCancelListeners.getListeners(); + // Check to make sure the request monitor wasn't previously canceled. + if (!fCanceled) { + fCanceled = true; + if (fCancelListeners != null) { + listeners = fCancelListeners.getListeners(); + } } } @@ -292,7 +295,8 @@ public class RequestMonitor { */ @ConfinedToDsfExecutor("fExecutor") protected void handleFailure() { - assert !getStatus().isOK(); + assert !isSuccess(); + if (isCanceled()) { handleCancel(); } else { @@ -300,9 +304,7 @@ public class RequestMonitor { DsfPlugin.getDefault().getLog().log(new Status( IStatus.ERROR, DsfPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Request monitor: '" + this + "' resulted in a cancel status: " + getStatus() + ", even though the request is not set to cancel.", null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - if (getStatus().getSeverity() > IStatus.INFO) { - handleErrorOrWarning(); - } + handleErrorOrWarning(); } } @@ -383,7 +385,6 @@ public class RequestMonitor { * rejects the runnable that is submitted invoke this request monitor. * This usually happens only when the executor is shutting down. */ - @ThreadSafe protected void handleRejectedExecutionException() { MultiStatus logStatus = new MultiStatus(DsfPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", null); //$NON-NLS-1$ //$NON-NLS-2$ logStatus.merge(getStatus());