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 f3b512f04f6..f6da42170a8 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 @@ -18,23 +18,23 @@ import org.eclipse.cdt.dsf.internal.DsfPlugin; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -/** - * A base implementation of a general purpose cache. Sub classes must implement - * {@link #retrieve(DataRequestMonitor)} to fetch data from the data source. - * Sub-classes or clients are also responsible for calling {@link #disable()} - * and {@link #reset()} to manage the state of the cache in response to events +/** + * A base implementation of a general purpose cache. Sub classes must implement + * {@link #retrieve(DataRequestMonitor)} to fetch data from the data source. + * Sub-classes are also responsible for calling {@link #set(Object, IStatus)} + * and {@link #reset()} to manage the state of the cache in response to events * from the data source. *
- * This cache requires an executor to use. The executor is used to synchronize - * access to the cache state and data. + * This cache requires an executor to use. The executor is used to synchronize + * access to the cache state and data. *
+ * * @since 2.2 */ @ConfinedToDsfExecutor("fExecutor") public abstract class AbstractCachenull
and an error
- * status with code {@link IDsfStatusConstants#INVALID_STATE}.
- *
- * @see #reset(Object, IStatus)
- */
+
+ /**
+ * Resets the cache, setting its data to null
, and status to
+ * {@link #INVALID_STATUS}. Equivalent to reset(null, INVALID_STATUS)
+ *
+ * @see #reset(Object, IStatus)
+ */
protected void reset() {
reset(null, INVALID_STATUS);
}
-
- /**
- * Resets the cache with given data and status. Resetting the cache
- * forces the cache to be invalid and cancels any current pending requests
- * from data source.
- * - * This method should be called when the data source has issued an event - * indicating that the source data has changed but data may still be - * retrieved. Clients may need to re-request data following cache reset. - *
- * @param data The data that should be returned to any clients currently - * waiting for cache data. - * @status The status that should be returned to any clients currently - * waiting for cache data. - */ + + /** + * Resets the cache, setting its data to [data], and status to [status]. + * Resetting the cache puts it in the invalid state and cancels any current + * pending requests to the data source. + * + *
+ * The cache should be reset when the data source has issued an event
+ * indicating that the source data has changed but data may still be
+ * retrieved. Clients may need to re-request data following a cache reset.
+ *
+ * @param data
+ * The data that should be returned to any client that calls
+ * {@link #getData()} despite the invalid state
+ * @status The status that should be returned to any client that calls
+ * {@link #getStatus()()} despite the invalid state
+ * @see #reset()
+ * @see #set(Object, IStatus)
+ */
protected void reset(V data, IStatus status) {
doSet(data, status, false);
- }
-
- /**
- * Disables the cache from retrieving data from the source. If the cache
- * is already valid the data and status is retained. If the cache is not
- * valid, then data value null
and an error status with code
- * {@link IDsfStatusConstants#INVALID_STATE} are set.
- *
- * @see #set(Object, IStatus)
- */
- protected void disable() {
- if (!fValid) {
- set(null, DISABLED_STATUS);
- }
}
- /**
- * Resets the cache then disables it. When a cache is disabled it means
- * that it is valid and requests to the data source will not be sent.
- *
- * This method should be called when the data source has issued an event - * indicating that the source data has changed and future requests for - * data will return the given data and status. Once the source data - * becomes available again, clients should call {@link #reset()}. - *
- * @param data The data that should be returned to any clients waiting for - * cache data and for clients requesting data until the cache is reset again. - * @status The status that should be returned to any clients waiting for - * cache data and for clients requesting data until the cache is reset again. - * - * @see #reset(Object, IStatus) - */ + /** + * Puts the cache into the valid state, given it new data and status. + * + * This method should be called when the subclass has received a response + * for updated data from the source. Note that such a response may be an + * error. That does not make the cache invalid. Invalid strictly means that + * the cache's data has either gone stale or that it's in the initial unset + * state. + * + * @param data + * The data that should be returned to any clients waiting for + * cache data and for clients requesting data, until the cache is + * invalidated via one of the reset methods. + * @status The status that should be returned to any clients waiting for + * cache data and for clients requesting status, until the cache is + * invalidated via one of the reset methods. + * + * @see #reset() + * @see #reset(Object, IStatus) + */ protected void set(V data, IStatus status) { doSet(data, status, true); } diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/ICache.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/ICache.java index a92d45103ad..c9b18f2f7a8 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/ICache.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/ICache.java @@ -42,24 +42,17 @@ public interface ICachetrue
if the cache is currently valid. I.e.
* whether the cache can return a value immediately without first
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 1c52b3099eb..8b8d157eaca 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
@@ -97,15 +97,6 @@ public abstract class RequestCache