Skip to content

Commit 1495f7a

Browse files
author
Markus Grönlund
committed
8345493: JFR: JVM.flush hangs intermittently
Reviewed-by: egahlin Backport-of: 4257215
1 parent c141aa1 commit 1495f7a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,4 +679,8 @@ public synchronized void migrate(SafePath repo) throws IOException {
679679
public RepositoryChunk getCurrentChunk() {
680680
return currentChunk;
681681
}
682+
683+
public synchronized void flush() {
684+
MetadataRepository.getInstance().flush();
685+
}
682686
}

src/jdk.jfr/share/classes/jdk/jfr/internal/periodic/FlushTask.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
2626

2727
import jdk.jfr.internal.JVM;
2828
import jdk.jfr.internal.MetadataRepository;
29+
import jdk.jfr.internal.PlatformRecorder;
30+
import jdk.jfr.internal.PrivateAccess;
2931
import jdk.jfr.internal.util.Utils;
3032

3133
/**
@@ -44,7 +46,8 @@ public FlushTask() {
4446

4547
@Override
4648
public void execute(long timestamp, PeriodicType periodicType) {
47-
MetadataRepository.getInstance().flush();
49+
PlatformRecorder recorder = PrivateAccess.getInstance().getPlatformRecorder();
50+
recorder.flush();
4851
Utils.notifyFlush();
4952
}
5053

0 commit comments

Comments
 (0)