Skip to content

Commit ea090f9

Browse files
fix: synchronization on bridge
1 parent f32dcef commit ea090f9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

internal-api/src/main/java/datadog/trace/api/debugger/DebuggerConfigBridge.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,46 @@ public static synchronized void updateConfig(DebuggerConfigUpdate update) {
2828
public static synchronized void setUpdater(@Nonnull DebuggerConfigUpdater updater) {
2929
UPDATER = updater;
3030
if (DEFERRED_UPDATE != null && DEFERRED_UPDATE.hasUpdates()) {
31-
DebuggerConfigUpdate toApply = DEFERRED_UPDATE;
31+
LOGGER.debug("Processing deferred update {}", DEFERRED_UPDATE);
32+
updater.updateConfig(DEFERRED_UPDATE);
3233
DEFERRED_UPDATE = null;
33-
LOGGER.debug("Processing deferred update {}", toApply);
34-
updater.updateConfig(toApply);
3534
}
3635
}
3736

3837
// for testing purposes
39-
static void reset() {
38+
static synchronized void reset() {
4039
UPDATER = null;
4140
DEFERRED_UPDATE = null;
4241
}
4342

4443
public static boolean isDynamicInstrumentationEnabled() {
45-
if (UPDATER != null) {
46-
return UPDATER.isDynamicInstrumentationEnabled();
44+
DebuggerConfigUpdater updater = UPDATER;
45+
if (updater != null) {
46+
return updater.isDynamicInstrumentationEnabled();
4747
}
4848
return Config.get().isDynamicInstrumentationEnabled();
4949
}
5050

5151
public static boolean isExceptionReplayEnabled() {
52-
if (UPDATER != null) {
53-
return UPDATER.isExceptionReplayEnabled();
52+
DebuggerConfigUpdater updater = UPDATER;
53+
if (updater != null) {
54+
return updater.isExceptionReplayEnabled();
5455
}
5556
return Config.get().isDebuggerExceptionEnabled();
5657
}
5758

5859
public static boolean isCodeOriginEnabled() {
59-
if (UPDATER != null) {
60-
return UPDATER.isCodeOriginEnabled();
60+
DebuggerConfigUpdater updater = UPDATER;
61+
if (updater != null) {
62+
return updater.isCodeOriginEnabled();
6163
}
6264
return Config.get().isDebuggerCodeOriginEnabled();
6365
}
6466

6567
public static boolean isDistributedDebuggerEnabled() {
66-
if (UPDATER != null) {
67-
return UPDATER.isDistributedDebuggerEnabled();
68+
DebuggerConfigUpdater updater = UPDATER;
69+
if (updater != null) {
70+
return updater.isDistributedDebuggerEnabled();
6871
}
6972
return Config.get().isDistributedDebuggerEnabled();
7073
}

0 commit comments

Comments
 (0)