Skip to content

Commit 8f2ef81

Browse files
committed
Make event listener map thread-safe
1 parent 9439c8f commit 8f2ef81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adapter/src/main/kotlin/org/javacs/ktda/jdi/event/VMEventBus.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.sun.jdi.event.LocatableEvent as JDILocatableEvent
1818
import com.sun.jdi.event.EventSet as JDIEventSet
1919
import com.sun.jdi.event.StepEvent as JDIStepEvent
2020
import com.sun.jdi.event.ExceptionEvent as JDIExceptionEvent
21+
import java.util.concurrent.ConcurrentHashMap
2122
import kotlin.reflect.KClass
2223

2324
/**
@@ -26,7 +27,7 @@ import kotlin.reflect.KClass
2627
*/
2728
class VMEventBus(private val vm: VirtualMachine): DebuggeeEventBus {
2829
private var exited = false
29-
private val eventListeners = mutableMapOf<KClass<out JDIEvent>, ListenerList<VMEvent<JDIEvent>>>()
30+
private val eventListeners = ConcurrentHashMap<KClass<out JDIEvent>, ListenerList<VMEvent<JDIEvent>>>()
3031
override val exitListeners = ListenerList<ExitEvent>()
3132
override val breakpointListeners = ListenerList<BreakpointStopEvent>()
3233
override val stepListeners = ListenerList<StepStopEvent>()

0 commit comments

Comments
 (0)