Search in sources :

Example 1 with RemoteDebuggerClient

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;
}
Also used : Debugger(org.intellij.plugins.xsltDebugger.rt.engine.Debugger) NotBoundException(java.rmi.NotBoundException) RemoteDebuggerClient(org.intellij.plugins.xsltDebugger.rt.engine.remote.RemoteDebuggerClient) IOException(java.io.IOException) ConnectException(java.rmi.ConnectException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IOException (java.io.IOException)1 ConnectException (java.rmi.ConnectException)1 NotBoundException (java.rmi.NotBoundException)1 Debugger (org.intellij.plugins.xsltDebugger.rt.engine.Debugger)1 RemoteDebuggerClient (org.intellij.plugins.xsltDebugger.rt.engine.remote.RemoteDebuggerClient)1 Nullable (org.jetbrains.annotations.Nullable)1