Skip to content

Commit 52cf791

Browse files
authored
Fix the temp location manager on J9 (#8002)
(due to a different mechanism to retrieve running JVM processes)
1 parent 4925a50 commit 52cf791

File tree

1 file changed

+2
-2
lines changed
  • dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller

1 file changed

+2
-2
lines changed

dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/TempLocationManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private class CleanupVisitor implements FileVisitor<Path> {
7171
private final Instant cutoff;
7272
private final Instant timeoutTarget;
7373

74-
private boolean terminated;
74+
private boolean terminated = false;
7575

7676
CleanupVisitor(boolean cleanSelf, long timeout, TimeUnit unit) {
7777
this.cleanSelf = cleanSelf;
@@ -107,7 +107,7 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
107107
// the JFR repository directories are under <basedir>/pid_<pid>
108108
String pid = fileName.startsWith("pid_") ? fileName.substring(4) : null;
109109
boolean isSelfPid = pid != null && pid.equals(PidHelper.getPid());
110-
shouldClean |= (cleanSelf && isSelfPid) || (!cleanSelf && !pidSet.contains(pid));
110+
shouldClean |= cleanSelf ? isSelfPid : !isSelfPid && !pidSet.contains(pid);
111111
if (shouldClean) {
112112
log.debug("Cleaning temporary location {}", dir);
113113
}

0 commit comments

Comments
 (0)