@Override public void stop() { if (getVm() != null) { send(new DlvRequest.Detach(true)); } getSession().stop(); }
@Nullable private String getWorkerID(@Nullable XSuspendContext context) { if (context != null) { XExecutionStack activeExecutionStack = context.getActiveExecutionStack(); if (activeExecutionStack instanceof BallerinaSuspendContext.BallerinaExecutionStack) { return ((BallerinaSuspendContext.BallerinaExecutionStack) activeExecutionStack).getMyWorkerID(); } } getSession().getConsoleView().print("Error occurred while getting the thread ID.", ConsoleViewContentType.ERROR_OUTPUT); getSession().stop(); return null; }
@Override public void stop() { // If we don't call this using the executeOnPooledThread(), the UI will hang until the debug server is stopped. ApplicationManager.getApplication().executeOnPooledThread(() -> { XDebugSession session = getSession(); if (!isRemoteDebugMode) { XSuspendContext suspendContext = session.getSuspendContext(); if (suspendContext != null) { XExecutionStack activeExecutionStack = suspendContext.getActiveExecutionStack(); if (activeExecutionStack instanceof BallerinaSuspendContext.BallerinaExecutionStack) { String workerID = ((BallerinaSuspendContext.BallerinaExecutionStack) activeExecutionStack) .getMyWorkerID(); if (workerID != null) { myConnector.sendCommand(Command.STOP, workerID); } } } else { session.stop(); return; } } else { myConnector.sendCommand(Command.STOP); session.stop(); getSession().getConsoleView().print("Disconnected from the debug server.\n", ConsoleViewContentType.SYSTEM_OUTPUT); } isDisconnected = true; myConnector.close(); }); }
myConnector.getDebugServerAddress() + " could not be established.\n", ConsoleViewContentType.ERROR_OUTPUT); getSession().stop();
if (session != null) { session.sessionResumed(); session.stop();