Skip to content

Commit bcc32e6

Browse files
committed
modify threadIdSet only in createThreadMonitoredDataResponse()
1 parent 3793933 commit bcc32e6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plugins/jfr.streaming/src/org/graalvm/visualvm/jfr/streaming/JFRThreadDataProvider.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public MonitoredNumbersResponse createThreadMonitoredDataResponse() {
9494
explicitStates[i] = te.status;
9595
explicitThreads[i] = (int) te.threadId;
9696
explicitTimeStamps[i] = te.timeStamp;
97+
if (te.status == CommonConstants.THREAD_STATUS_ZOMBIE) {
98+
threadIdSet.remove(te.threadId);
99+
}
97100
}
98101
events.clear();
99102
rp.setExplicitDataOnThreads(explicitThreads, explicitStates, explicitTimeStamps);
@@ -144,16 +147,11 @@ public void cleanup() {
144147

145148
private void addThreadEnd(long id, Instant startTime) {
146149
addEvent(id, CommonConstants.THREAD_STATUS_ZOMBIE, startTime.toEpochMilli());
147-
synchronized (newThreads) {
148-
threadIdSet.remove(id);
149-
}
150150
}
151151

152152
private void addThreadStart(Instant startTime, long javaThreadId, String javaName) {
153153
synchronized (newThreads) {
154-
if (threadIdSet.add(javaThreadId)) {
155-
newThreads.add(new JFRThread(javaThreadId, javaName));
156-
}
154+
newThreads.add(new JFRThread(javaThreadId, javaName));
157155
}
158156
}
159157

0 commit comments

Comments
 (0)