Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-11-10 16:47:55 +0000
committerJohn Cortell2010-11-10 16:47:55 +0000
commit5fa5ff3a8138a7f90645a606e35e7a6695fad5c6 (patch)
tree6cb941a3288f5bfc152e1af83526d0f32a0da28e /dsf/org.eclipse.cdt.dsf
parent85b40d1d99aa62fde8355b2368bd1a5986c6c55c (diff)
downloadorg.eclipse.cdt-5fa5ff3a8138a7f90645a606e35e7a6695fad5c6.tar.gz
org.eclipse.cdt-5fa5ff3a8138a7f90645a606e35e7a6695fad5c6.tar.xz
org.eclipse.cdt-5fa5ff3a8138a7f90645a606e35e7a6695fad5c6.zip
Bug 329481: Inconsistency in DSF ACPM cancel behavior.
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/AbstractCache.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestCache.java22
2 files changed, 11 insertions, 13 deletions
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/AbstractCache.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/AbstractCache.java
index e6985ea6bf1..e4ad222a077 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/AbstractCache.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/AbstractCache.java
@@ -37,7 +37,7 @@ public abstract class AbstractCache<V> implements ICache<V> {
private class RequestCanceledListener implements RequestMonitor.ICanceledListener {
public void requestCanceled(final RequestMonitor canceledRm) {
- fExecutor.execute(new Runnable() {
+ fExecutor.getDsfExecutor().execute(new Runnable() {
public void run() {
handleCanceledRm(canceledRm);
}
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestCache.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestCache.java
index dbf8f669b31..76b94d6e145 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestCache.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestCache.java
@@ -12,7 +12,6 @@ package org.eclipse.cdt.dsf.concurrent;
*******************************************************************************/
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
/**
* A general purpose cache, which caches the result of a single request.
@@ -46,26 +45,25 @@ public abstract class RequestCache<V> extends AbstractCache<V> {
fRm = new DataRequestMonitor<V>(getImmediateInDsfExecutor(), null) {
- private IStatus fRawStatus = Status.OK_STATUS;
-
@Override
protected void handleCompleted() {
if (this == fRm) {
fRm = null;
- IStatus status;
- synchronized (this) {
- status = fRawStatus;
+ // If the requestor canceled the request, then leave the
+ // cache as is, regardless of how the retrieval completes.
+ // We want the cache to stay in the invalid state so that
+ // it remains functional. The request may have completed
+ // successfully, and it may be tempting to use the result in
+ // that case, but that opens up a can of worms. We'll follow
+ // the behavior in RequestMonitor: when an RM is canceled,
+ // it's canceled; period.
+ if (!isCanceled()) {
+ set(getData(), getStatus());
}
- set(getData(), status);
}
}
@Override
- public synchronized void setStatus(IStatus status) {
- fRawStatus = status;
- };
-
- @Override
public boolean isCanceled() {
return super.isCanceled() || RequestCache.this.isCanceled();
};

Back to the top