[debugger] HotSwap: use postStartupActivity instead of preload=true

GitOrigin-RevId: 89fd3c8a8ac3fb73b8e9dc348e9df418f81bb362
This commit is contained in:
Maksim Zuev
2025-05-12 16:18:51 +00:00
committed by intellij-monorepo-bot
parent 63d0d04c7e
commit c9c5a844e6
2 changed files with 11 additions and 1 deletions
@@ -93,7 +93,7 @@
<applicationService serviceImplementation="com.intellij.debugger.settings.ThreadsViewSettings"/>
<applicationService serviceImplementation="com.intellij.debugger.settings.TraceSettings"/>
<projectService serviceInterface="com.intellij.debugger.ui.HotSwapUI" serviceImplementation="com.intellij.debugger.ui.HotSwapUIImpl"/>
<projectService serviceImplementation="com.intellij.debugger.impl.hotswap.HotSwapDebugSessionManager" preload="true"/>
<postStartupActivity implementation="com.intellij.debugger.impl.hotswap.HotSwapManagerInitActivity"/>
<projectService serviceInterface="com.intellij.debugger.DebuggerManager"
serviceImplementation="com.intellij.debugger.impl.DebuggerManagerImpl"/>
<debugger.additionalContextProvider implementation="com.intellij.debugger.engine.evaluation.MarkedObjectAdditionalContextProvider"/>
@@ -5,8 +5,11 @@ import com.intellij.debugger.engine.JavaDebugProcess
import com.intellij.debugger.impl.DebuggerSession
import com.intellij.debugger.ui.HotSwapStatusListener
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.components.serviceAsync
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.registry.Registry
import com.intellij.util.asDisposable
@@ -23,6 +26,13 @@ import java.util.concurrent.ConcurrentHashMap
private data class JavaHotSwapSessionEntry(val hotSwapSession: HotSwapSession<*>, val disposable: Disposable)
private class HotSwapManagerInitActivity : ProjectActivity {
override suspend fun execute(project: Project) {
project.serviceAsync<HotSwapDebugSessionManager>()
}
}
@Service(Service.Level.PROJECT)
internal class HotSwapDebugSessionManager(project: Project, cs: CoroutineScope) : XDebuggerManagerListener {
private val sessions = ConcurrentHashMap<DebuggerSession, JavaHotSwapSessionEntry>()