void () { while (myShouldAccept) { try { final ServerSocket serverSocketCopy = myServerSocket; if (serverSocketCopy == null) { break; } Socket socket; if (myMultiProcessDebugger.useDispatcher()) { socket = serverSocketCopy.accept(); } else { socket = null; } try { final ServerSocket serverSocket; if (socket != null) { serverSocket = createServerSocket(); } else { serverSocket = serverSocketCopy; } final RemoteDebugger debugger = new RemoteDebugger(myMultiProcessDebugger.myDebugProcess, serverSocket, myMultiProcessDebugger.myTimeoutInMillis); addCloseListener(debugger); if (socket != null) { sendDebuggerPort(socket, serverSocket, myMultiProcessDebugger.myDebugProcess); socket.close(); } debugger.waitForConnect(); debugger.handshake(); myMultiProcessDebugger.addDebugger(debugger); myMultiProcessDebugger.myDebugProcess.init(); debugger.run(); } catch (Exception e) { LOG.warn(e); } finally { if (socket != null && !socket.isClosed()) { socket.close(); } } } catch (Exception ignore) { if (myServerSocket == null) { myShouldAccept = false; } } } }