1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 22:45:23 +02:00

[179293] Further refactoring of the handle*() methods of the RequestMoniotr.

This commit is contained in:
Pawel Piech 2008-03-27 16:18:04 +00:00
parent 0ab189a725
commit c60f80ccc0

View file

@ -163,11 +163,14 @@ public class RequestMonitor {
public void cancel() { public void cancel() {
Object[] listeners = null; Object[] listeners = null;
synchronized (this) { synchronized (this) {
// Check to make sure the request monitor wasn't previously canceled.
if (!fCanceled) {
fCanceled = true; fCanceled = true;
if (fCancelListeners != null) { if (fCancelListeners != null) {
listeners = fCancelListeners.getListeners(); listeners = fCancelListeners.getListeners();
} }
} }
}
// Call the listeners outsize of a synchronized section to reduce the // Call the listeners outsize of a synchronized section to reduce the
// risk of deadlocks. // risk of deadlocks.
@ -292,7 +295,8 @@ public class RequestMonitor {
*/ */
@ConfinedToDsfExecutor("fExecutor") @ConfinedToDsfExecutor("fExecutor")
protected void handleFailure() { protected void handleFailure() {
assert !getStatus().isOK(); assert !isSuccess();
if (isCanceled()) { if (isCanceled()) {
handleCancel(); handleCancel();
} else { } else {
@ -300,11 +304,9 @@ public class RequestMonitor {
DsfPlugin.getDefault().getLog().log(new Status( 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$ 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();
} }
} }
}
/** /**
* The default implementation of an error or warning result of a request. * The default implementation of an error or warning result of a request.
@ -383,7 +385,6 @@ public class RequestMonitor {
* rejects the runnable that is submitted invoke this request monitor. * rejects the runnable that is submitted invoke this request monitor.
* This usually happens only when the executor is shutting down. * This usually happens only when the executor is shutting down.
*/ */
@ThreadSafe
protected void handleRejectedExecutionException() { 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$ 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()); logStatus.merge(getStatus());