[Gradle] use disconnect operation only on project close to avoid cancellation of unrelated builds IDEA-185242 IDEA-202453

GitOrigin-RevId: 2d589c21e7db64b00aa0ce52c1f383433053a62b
This commit is contained in:
Vladislav.Soroka
2020-06-09 08:35:23 +03:00
committed by intellij-monorepo-bot
parent 8544b08e27
commit 41d68b444e
@@ -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)