Skip to content

Commit d6eb0eb

Browse files
committed
SLCORE-1649 Only send "flight recorder stopped" event when actually enabled
1 parent da87388 commit d6eb0eb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backend/core/src/main/java/org/sonarsource/sonarlint/core/flight/recorder/FlightRecorderService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,19 @@ public void launch() {
9797

9898
@PreDestroy
9999
public void shutdown() {
100+
if (!enabled) {
101+
return;
102+
}
103+
100104
sendInfoEvent("Flight recorder stopped");
101105
}
102106

103107
public void captureThreadDump() {
108+
if (!enabled) {
109+
LOG.debug("Ignoring thread dump capture request, not in a flight recording session");
110+
return;
111+
}
112+
104113
var threadDump = new StringBuilder();
105114
var threadBean = ManagementFactory.getThreadMXBean();
106115
Arrays.stream(threadBean.dumpAllThreads(true, true))

0 commit comments

Comments
 (0)