use of org.intellij.plugins.xsltDebugger.rt.engine.remote.RemoteDebuggerClient in project intellij-community by JetBrains.
the class DebuggerConnector method connect.
@Nullable
private Debugger connect() {
Throwable lastException = null;
for (int i = 0; i < 10; i++) {
if (myProcess.isProcessTerminated())
return null;
try {
final Debugger realClient = EDTGuard.create(new RemoteDebuggerClient(myPort), myProcess);
myProcess.notifyTextAvailable("Connected to XSLT debugger on port " + myPort + "\n", ProcessOutputTypes.SYSTEM);
return realClient;
} catch (ConnectException e) {
lastException = e;
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
break;
}
} catch (NotBoundException e) {
lastException = e;
try {
Thread.sleep(200);
} catch (InterruptedException e1) {
break;
}
} catch (IOException e) {
lastException = e;
break;
}
}
if (lastException != null) {
Logger.getInstance(getClass().getName()).info("Could not connect to debugger", lastException);
if (lastException.getMessage() != null) {
myProcess.notifyTextAvailable("Connection error: " + lastException.getMessage() + "\n", ProcessOutputTypes.SYSTEM);
}
}
return null;
}
Aggregations