more error handling and logging to sort out #4735

This commit is contained in:
Ben Fry
2016-11-08 13:49:54 -05:00
parent f7efff5077
commit 10eb4af3be

View File

@@ -33,6 +33,7 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.io.*;
import java.net.ConnectException;
import java.util.*;
import com.sun.jdi.*;
@@ -220,21 +221,29 @@ public class Runner implements MessageConsumer {
// while (!available) {
while (true) {
try {
Messages.log(getClass().getName() + " attempting to attach to VM");
vm = connector.attach(arguments);
// vm = connector.attach(arguments);
if (vm != null) {
Messages.log(getClass().getName() + " attached to the VM");
// generateTrace();
// available = true;
return true;
}
} catch (IOException e) {
} catch (ConnectException ce) {
// This will fire ConnectException (socket not available) until
// the VM finishes starting up and opens its socket for us.
Messages.log(getClass().getName() + " socket for VM not ready");
// System.out.println("waiting");
// e.printStackTrace();
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
e1.printStackTrace(sketchErr);
} catch (InterruptedException ie) {
Messages.loge(getClass().getName() + " interrupted", ie);
// ie.printStackTrace(sketchErr);
}
} catch (IOException e) {
Messages.loge(getClass().getName() + " while attaching to VM", e);
}
}
// } catch (IOException exc) {