1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

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>
This commit is contained in:
Jonah Graham 2017-03-04 11:20:02 +00:00 committed by Gerrit Code Review @ Eclipse.org
parent 1e60830c7d
commit 6ca1d5cc28
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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());