summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Ostroukhov 2011-08-30 15:20:25 (EDT)
committerMarc Khouzam2011-08-30 15:20:25 (EDT)
commit97d0869a9a9c5f10a9e52dcdf7dfd5b2b115a023 (patch)
treefc0f1eaed09102f3238b2dcfb43bcfba9cce8425
parenta8522bf2a17e8ed808f938406f5ba6f8b11dd151 (diff)
downloadorg.eclipse.cdt-97d0869a9a9c5f10a9e52dcdf7dfd5b2b115a023.zip
org.eclipse.cdt-97d0869a9a9c5f10a9e52dcdf7dfd5b2b115a023.tar.gz
org.eclipse.cdt-97d0869a9a9c5f10a9e52dcdf7dfd5b2b115a023.tar.bz2
Bug 352888: Add two new "done" methods to RequestMonitor and DataRequestMonitor
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF2
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DataRequestMonitor.java23
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestMonitor.java29
4 files changed, 51 insertions, 8 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
index 2a7bfc0..6cba61a 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java
@@ -566,11 +566,10 @@ public class SyncUtil {
Assert.assertEquals("unexpected number of processes", 1, contexts.length);
IDMContext context = contexts[0];
Assert.assertNotNull("unexpected process context type ", context);
- rm.setData((IContainerDMContext)context);
+ rm.done((IContainerDMContext)context);
} else {
- rm.setStatus(getStatus());
+ rm.done(getStatus());
}
- rm.done();
}
});
}
diff --git a/dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF b/dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF
index c912169..6710e23 100644
--- a/dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF
+++ b/dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf;singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.internal.DsfPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DataRequestMonitor.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DataRequestMonitor.java
index b185fed..38f6838 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DataRequestMonitor.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/DataRequestMonitor.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * Eugene Ostroukhov (NVIDIA) - new done(V) method
*******************************************************************************/
package org.eclipse.cdt.dsf.concurrent;
@@ -33,6 +34,8 @@ public class DataRequestMonitor<V> extends RequestMonitor {
* Sets the data object to specified value. To be called by the
* asynchronous method implementor.
* @param data Data value to set.
+ *
+ * @see #done(Object)
*/
public synchronized void setData(V data) { fData = data; }
@@ -41,6 +44,26 @@ public class DataRequestMonitor<V> extends RequestMonitor {
*/
public synchronized V getData() { return fData; }
+ /**
+ * Completes the monitor setting data object to specified value. To be
+ * called by asynchronous method implementor.
+ *
+ * <p>
+ * Note: Only one <code>done</code> method should be called and only once,
+ * for every request issued. Even if the request was canceled.
+ * </p>
+ *
+ * @param data Data value to set
+ * @see #setData(Object)
+ * @see #done()
+ * @see #done(org.eclipse.core.runtime.IStatus)
+ * @since 2.3
+ */
+ public synchronized void done(V data) {
+ setData(data);
+ done();
+ }
+
@Override
public String toString() {
if (getData() != null) {
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestMonitor.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestMonitor.java
index 09f8769..7bc6c32 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestMonitor.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/RequestMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Wind River Systems and others.
+ * Copyright (c) 2006, 2011 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * Eugene Ostroukhov (NVIDIA) - new done(IStatus) method
*******************************************************************************/
package org.eclipse.cdt.dsf.concurrent;
@@ -165,7 +166,9 @@ public class RequestMonitor extends DsfExecutable {
/**
* Sets the status of the result of the request. If status is OK, this
- * method does not need to be called.
+ * method does not need to be called.
+ *
+ * @see #done(IStatus)
*/
public synchronized void setStatus(IStatus status) {
assert isCanceled() || status.getSeverity() != IStatus.CANCEL;
@@ -270,8 +273,8 @@ public class RequestMonitor extends DsfExecutable {
* monitor submits a runnable to the DSF Executor to call the
* <code>handle...</code> methods.
* <p>
- * Note: This method should be called once and only once, for every request
- * issued. Even if the request was canceled.
+ * Note: Only one <code>done</code> method should be called and only once,
+ * for every request issued. Even if the request was canceled.
* </p>
*/
public synchronized void done() {
@@ -306,6 +309,24 @@ public class RequestMonitor extends DsfExecutable {
handleRejectedExecutionException();
}
}
+
+ /**
+ * Sets status and marks request monitor as completed.
+ *
+ * <p>
+ * Note: Only one <code>done</code> method should be called and only once,
+ * for every request issued. Even if the request was canceled.
+ * </p>
+ *
+ * @param status Request processing status
+ * @see #done()
+ * @see #setStatus(IStatus)
+ * @since 2.3
+ */
+ public synchronized void done(IStatus status) {
+ setStatus(status);
+ done();
+ }
@Override
public String toString() {