File tree Expand file tree Collapse file tree
java/src/processing/mode/java/runner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333import java .awt .GraphicsEnvironment ;
3434import java .awt .Point ;
3535import java .io .*;
36+ import java .net .ConnectException ;
3637import java .util .*;
3738
3839import 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) {
You can’t perform that action at this time.
0 commit comments