Skip to content

Commit b37a6bc

Browse files
committed
more error handling and logging to sort out processing#4735
1 parent 4e7337d commit b37a6bc

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

java/src/processing/mode/java/runner/Runner.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.awt.GraphicsEnvironment;
3434
import java.awt.Point;
3535
import java.io.*;
36+
import java.net.ConnectException;
3637
import java.util.*;
3738

3839
import com.sun.jdi.*;
@@ -220,21 +221,29 @@ public boolean launchVirtualMachine(boolean present, String[] args) {
220221
// while (!available) {
221222
while (true) {
222223
try {
224+
Messages.log(getClass().getName() + " attempting to attach to VM");
223225
vm = connector.attach(arguments);
224226
// vm = connector.attach(arguments);
225227
if (vm != null) {
228+
Messages.log(getClass().getName() + " attached to the VM");
226229
// generateTrace();
227230
// available = true;
228231
return true;
229232
}
230-
} catch (IOException e) {
233+
} catch (ConnectException ce) {
234+
// This will fire ConnectException (socket not available) until
235+
// the VM finishes starting up and opens its socket for us.
236+
Messages.log(getClass().getName() + " socket for VM not ready");
231237
// System.out.println("waiting");
232238
// e.printStackTrace();
233239
try {
234240
Thread.sleep(100);
235-
} catch (InterruptedException e1) {
236-
e1.printStackTrace(sketchErr);
241+
} catch (InterruptedException ie) {
242+
Messages.loge(getClass().getName() + " interrupted", ie);
243+
// ie.printStackTrace(sketchErr);
237244
}
245+
} catch (IOException e) {
246+
Messages.loge(getClass().getName() + " while attaching to VM", e);
238247
}
239248
}
240249
// } catch (IOException exc) {

0 commit comments

Comments
 (0)