Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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 e6985ea6bf..e4ad222a07 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 dbf8f669b3..76b94d6e14 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