8345493: JFR: JVM.flush hangs intermittently

Reviewed-by: egahlin
This commit is contained in:
Markus Grönlund 2025-01-15 16:17:26 +00:00
parent a0f7982e44
commit 4257215a9f
2 changed files with 9 additions and 2 deletions

View File

@ -650,4 +650,8 @@ public final class PlatformRecorder {
public RepositoryChunk getCurrentChunk() {
return currentChunk;
}
public synchronized void flush() {
MetadataRepository.getInstance().flush();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@ package jdk.jfr.internal.periodic;
import jdk.jfr.internal.JVM;
import jdk.jfr.internal.MetadataRepository;
import jdk.jfr.internal.PlatformRecorder;
import jdk.jfr.internal.PrivateAccess;
import jdk.jfr.internal.util.Utils;
/**
@ -44,7 +46,8 @@ final class FlushTask extends PeriodicTask {
@Override
public void execute(long timestamp, PeriodicType periodicType) {
MetadataRepository.getInstance().flush();
PlatformRecorder recorder = PrivateAccess.getInstance().getPlatformRecorder();
recorder.flush();
Utils.notifyFlush();
}