void () { ProgressIndicator indicator = new EmptyProgressIndicator(); String dirForLogs = myMultimoduleDirectories.iterator().next(); MavenLog.LOG.debug("Connecting maven connector in " + dirForLogs); try { if (myDebugPort != null) { //noinspection UseOfSystemOutOrSystemErr System.out.println("Listening for transport dt_socket at address: " + myDebugPort); } MavenRemoteProcessSupportFactory factory = MavenRemoteProcessSupportFactory.forIndexer(); mySupport = factory.createIndexerSupport(myJdk, myVmOptions, myDistribution, myDebugPort); mySupport.onTerminate(e -> { MavenLog.LOG.debug("[connector] terminate " + MavenIndexingConnectorImpl.this); MavenServerManager.getInstance().shutdownConnector(MavenIndexingConnectorImpl.this, false); }); // Maven server's lifetime is bigger than the activity that spawned it, so we let it go untracked try (AccessToken ignored = ThreadContext.resetThreadContext()) { MavenServer server = mySupport.acquire(this, "", indicator); myServerPromise.setResult(server); } MavenLog.LOG.debug("[connector] in " + dirForLogs + " has been connected " + MavenIndexingConnectorImpl.this); } catch (Throwable e) { MavenLog.LOG.warn("[connector] cannot connect in " + dirForLogs, e); myServerPromise.setError(e); } }