Minor: remove default value of retryOnConnectionError parameter

This commit is contained in:
Alexey Tsvetkov
2016-12-19 18:11:18 +03:00
parent 254d051a1f
commit 434f33f9e9
2 changed files with 4 additions and 4 deletions
@@ -152,7 +152,7 @@ abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
else -> throw IllegalArgumentException("Unknown compiler type $compilerClassName") else -> throw IllegalArgumentException("Unknown compiler type $compilerClassName")
} }
val res: Int = withDaemon(environment) { daemon, sessionId -> val res: Int = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId ->
KotlinCompilerClient.incrementalCompile(daemon, sessionId, targetPlatform, argsArray, services, compilerOut, daemonOut) KotlinCompilerClient.incrementalCompile(daemon, sessionId, targetPlatform, argsArray, services, compilerOut, daemonOut)
} ?: return null } ?: return null
@@ -164,11 +164,11 @@ abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
return exitCode return exitCode
} }
protected fun <T> withDaemon(environment: Env, retryOnConnectionError: Boolean = true, fn: (CompileService, sessionId: Int)->T): T? { protected fun <T> withDaemon(environment: Env, retryOnConnectionError: Boolean, fn: (CompileService, sessionId: Int)->T): T? {
fun retryOrFalse(e: Exception): T? { fun retryOrFalse(e: Exception): T? {
if (retryOnConnectionError) { if (retryOnConnectionError) {
log.debug("retrying once on daemon connection error: ${e.message}") log.debug("retrying once on daemon connection error: ${e.message}")
return withDaemon(environment, false, fn) return withDaemon(environment, retryOnConnectionError = false, fn = fn)
} }
log.info("daemon connection error: ${e.message}") log.info("daemon connection error: ${e.message}")
return null return null
@@ -157,7 +157,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
val compilerOut = ByteArrayOutputStream() val compilerOut = ByteArrayOutputStream()
val daemonOut = ByteArrayOutputStream() val daemonOut = ByteArrayOutputStream()
val res = withDaemon(environment) { daemon, sessionId -> val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId ->
val remoteCompilerOut = RemoteOutputStreamServer(compilerOut, port) val remoteCompilerOut = RemoteOutputStreamServer(compilerOut, port)
val remoteDaemonOut = RemoteOutputStreamServer(daemonOut, port) val remoteDaemonOut = RemoteOutputStreamServer(daemonOut, port)
daemon.serverSideJvmIC(sessionId, argsArray, services, remoteCompilerOut, remoteDaemonOut, null) daemon.serverSideJvmIC(sessionId, argsArray, services, remoteCompilerOut, remoteDaemonOut, null)