Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2017-03-04 11:20:02 +0000
committerGerrit Code Review @ Eclipse.org2017-03-07 14:21:15 +0000
commit6ca1d5cc28968f8ab82f7628623a238492787ecd (patch)
treeab4ccda644879ed22796970fca906b6d2cd6af5e /dsf-gdb
parent1e60830c7dd670ca3c97e00d8bbe79e7786ce4b7 (diff)
downloadorg.eclipse.cdt-6ca1d5cc28968f8ab82f7628623a238492787ecd.tar.gz
org.eclipse.cdt-6ca1d5cc28968f8ab82f7628623a238492787ecd.tar.xz
org.eclipse.cdt-6ca1d5cc28968f8ab82f7628623a238492787ecd.zip
Bug 512180: Ensure previous launch is fully terminated
This has two parts. 1) In the base test itself check that the executor is shutdown. 2) GDBBackend leaves a timeout job on the executor queue, remove it proactively so the executor doesn't sit around just waiting for it to terminate. Change-Id: I9fc10f70031430f4613e0edc95093a60cf695e90 Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java2
2 files changed, 5 insertions, 2 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
index 9a40b05a890..0d062356052 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBackend.java
@@ -24,6 +24,7 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.eclipse.cdt.core.parser.util.StringUtil;
@@ -495,6 +496,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
class GDBLaunchMonitor {
boolean fLaunched = false;
boolean fTimedOut = false;
+ public ScheduledFuture<?> fTimeoutFuture;
}
final GDBLaunchMonitor fGDBLaunchMonitor = new GDBLaunchMonitor();
@@ -503,6 +505,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
protected void handleCompleted() {
if (!fGDBLaunchMonitor.fTimedOut) {
fGDBLaunchMonitor.fLaunched = true;
+ fGDBLaunchMonitor.fTimeoutFuture.cancel(false);
if (!isSuccess()) {
requestMonitor.setStatus(getStatus());
}
@@ -607,7 +610,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
};
startGdbJob.schedule();
- getExecutor().schedule(new Runnable() {
+ fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(new Runnable() {
@Override
public void run() {
// Only process the event if we have not finished yet (hit
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
index 7aee5e59339..0bd551e0383 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
@@ -577,7 +577,7 @@ public class BaseTestCase {
if (launch != null) {
// Give a few seconds to allow the launch to terminate
int waitCount = 100;
- while (!launch.isTerminated() && --waitCount > 0) {
+ while (!launch.isTerminated() && !launch.getDsfExecutor().isShutdown() && --waitCount > 0) {
Thread.sleep(TestsPlugin.massageTimeout(100));
}
assertTrue("Launch failed to terminate before timeout", launch.isTerminated());

Back to the top