From 41d68b444e73a8d4bbb95d22d6e99e3be43b76b2 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Tue, 9 Jun 2020 08:34:22 +0300 Subject: [PATCH] [Gradle] use disconnect operation only on project close to avoid cancellation of unrelated builds IDEA-185242 IDEA-202453 GitOrigin-RevId: 2d589c21e7db64b00aa0ce52c1f383433053a62b --- .../plugins/gradle/GradleConnectorService.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleConnectorService.kt b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleConnectorService.kt index 301dd302c10c..250e9031fa11 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleConnectorService.kt +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleConnectorService.kt @@ -90,14 +90,9 @@ class GradleConnectorService(@Suppress("UNUSED_PARAMETER") project: Project) : D workaroundJavaVersionIssueIfNeeded(newConnection, taskId, listener, cancellationToken) if (conn != null && connectorParams != conn.params) { - if (connectorParams.distributionType == DistributionType.WRAPPED && conn.params.distributionType == DistributionType.WRAPPED) { - val unwrappedConnection = conn.connection as WrappedConnection - unwrappedConnection.delegate.close() - } - else { - // release obsolete connection - conn.disconnect() - } + // close obsolete connection, can not disconnect the connector here - it may cause build cancel for the new connection operations + val unwrappedConnection = conn.connection as WrappedConnection + unwrappedConnection.delegate.close() } val wrappedConnection = WrappedConnection(newConnection) return@compute GradleProjectConnection(connectorParams, newConnector, wrappedConnection)