Make getDaemonConnection synchronized to avoid racing conditions on connection
Original commit: 5b5ec2cb04
This commit is contained in:
@@ -128,9 +128,9 @@ public object KotlinCompilerRunner {
|
|||||||
internal class DaemonConnection(public val daemon: CompileService?)
|
internal class DaemonConnection(public val daemon: CompileService?)
|
||||||
|
|
||||||
internal object getDaemonConnection {
|
internal object getDaemonConnection {
|
||||||
private var connection: DaemonConnection? = null
|
private @Volatile var connection: DaemonConnection? = null
|
||||||
|
|
||||||
operator fun invoke(environment: CompilerEnvironment, messageCollector: MessageCollector): DaemonConnection? {
|
@Synchronized operator fun invoke(environment: CompilerEnvironment, messageCollector: MessageCollector): DaemonConnection? {
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
val libPath = CompilerRunnerUtil.getLibPath(environment.kotlinPaths, messageCollector)
|
val libPath = CompilerRunnerUtil.getLibPath(environment.kotlinPaths, messageCollector)
|
||||||
val compilerId = CompilerId.makeCompilerId(File(libPath, "kotlin-compiler.jar"))
|
val compilerId = CompilerId.makeCompilerId(File(libPath, "kotlin-compiler.jar"))
|
||||||
|
|||||||
Reference in New Issue
Block a user