Skip to content

Commit

Permalink
[Daemon] Fix new symbols naming
Browse files Browse the repository at this point in the history
^KT-72373 Fixed
  • Loading branch information
ALikhachev authored and qodana-bot committed Oct 22, 2024
1 parent 0fca927 commit a80a26b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ object KotlinCompilerClient {
val ignoredDaemonSessionFiles = mutableSetOf<File>()
var daemonStartupAttemptsCount = 0
val gcAutoConfiguration = GcAutoConfiguration()
val initiatorInfo = InitiatorInformation(clientAliveFlagFile)
val initialClientInfo = InitialClientInformation(clientAliveFlagFile)
return connectLoop(reportingTargets, autostart) { isLastAttempt ->

fun CompileService.tryToLeaseSession(): CompileServiceSession? {
Expand Down Expand Up @@ -166,7 +166,7 @@ object KotlinCompilerClient {
reportingTargets,
daemonStartupAttemptsCount++,
gcAutoConfiguration,
initiatorInfo,
initialClientInfo,
)
) {
reportingTargets.report(DaemonReportCategory.DEBUG, "new compiler daemon started, trying to find it")
Expand Down Expand Up @@ -511,7 +511,7 @@ object KotlinCompilerClient {
reportingTargets: DaemonReportingTargets,
startupAttempt: Int,
gcAutoConfiguration: GcAutoConfiguration,
initiatorInfo: InitiatorInformation,
initialClientInfo: InitialClientInformation,
): Boolean {
val javaExecutable = File(File(CompilerSystemProperties.JAVA_HOME.safeValue, "bin"), "java")
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value
Expand Down Expand Up @@ -541,7 +541,7 @@ object KotlinCompilerClient {
)
// TODO: KT-72161. Investigate IDEA's JSR223 Kotlin Script integration. Possibly transform this into regular arguments
val initiatorInfoAsSystemProperties = listOfNotNull(
initiatorInfo.clientMarkerFile?.absolutePath?.let {
initialClientInfo.aliveFlagFile?.absolutePath?.let {
"-D${CompilerSystemProperties.COMPILE_DAEMON_INITIATOR_MARKER_FILE.property}=$it"
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ data class CompilerId(
* Contains optional information about the client initiated daemon startup
* The information is used as a shortcut for registering the client as soon as possible, avoiding issues like KT-69929
*/
data class InitiatorInformation(
var clientMarkerFile: File? = null,
data class InitialClientInformation(
var aliveFlagFile: File? = null,
) : OptionsGroup {

override val mappers: List<PropMapper<*, *, *>>
get() = listOf(PropMapper(this, InitiatorInformation::clientMarkerFile, toString = { it?.absolutePath }, fromString = { File(it) }))
get() = listOf(PropMapper(this, InitialClientInformation::aliveFlagFile, toString = { it?.absolutePath }, fromString = { File(it) }))
}

fun isDaemonEnabled(): Boolean = CompilerSystemProperties.COMPILE_DAEMON_ENABLED_PROPERTY.value != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import java.io.IOException
import java.io.OutputStream
import java.io.PrintStream
import java.lang.management.ManagementFactory
import java.net.URLClassLoader
import java.text.SimpleDateFormat
import java.util.*
import java.util.jar.Manifest
Expand Down Expand Up @@ -105,7 +104,7 @@ abstract class KotlinCompileDaemonBase {

val compilerId = CompilerId()
val daemonOptions = DaemonOptions()
val initiatorInfo = InitiatorInformation(CompilerSystemProperties.COMPILE_DAEMON_INITIATOR_MARKER_FILE.value?.let { File(it) })
val initialClientInfo = InitialClientInformation(CompilerSystemProperties.COMPILE_DAEMON_INITIATOR_MARKER_FILE.value?.let { File(it) })
runSynchronized {
var serverRun: Any?
try {
Expand Down Expand Up @@ -147,7 +146,7 @@ abstract class KotlinCompileDaemonBase {
val timer = Timer(true)
val (compilerService, port) = getCompileServiceAndPort(compilerSelector, compilerId, daemonOptions, daemonJVMOptions, timer)
compilerService.startDaemonElections()
compilerService.registerClient(initiatorInfo)
compilerService.registerInitialClient(initialClientInfo)
compilerService.configurePeriodicActivities()
serverRun = runCompileService(compilerService)

Expand Down Expand Up @@ -175,8 +174,8 @@ abstract class KotlinCompileDaemonBase {
}
}

private fun CompileService.registerClient(information: InitiatorInformation) {
information.clientMarkerFile?.let {
private fun CompileService.registerInitialClient(initialClient: InitialClientInformation) {
initialClient.aliveFlagFile?.let {
registerClient(it.absolutePath)
}
}
Expand Down

0 comments on commit a80a26b

Please sign in to comment.