From 66bf03b74f4e77c8ad0bf2d1f42b332781959178 Mon Sep 17 00:00:00 2001 From: Denghui Dong Date: Sat, 15 Feb 2020 10:27:38 +0800 Subject: [PATCH] [Backport] 8230400: Missing constant pool entry for a method in stacktrace Summary: Test Plan: jdk/jfr Reviewed-by: yuleil Issue: https://github.com/alibaba/dragonwell8/issues/112 --- .../jdk/jfr/internal/MetadataRepository.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/share/classes/jdk/jfr/internal/MetadataRepository.java b/src/share/classes/jdk/jfr/internal/MetadataRepository.java index b0b0db71d..b718664e1 100644 --- a/src/share/classes/jdk/jfr/internal/MetadataRepository.java +++ b/src/share/classes/jdk/jfr/internal/MetadataRepository.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -232,20 +232,22 @@ public final class MetadataRepository { staleMetadata = true; } - // Lock around setOutput ensures that other threads dosn't - // emit event after setOutput and unregister the event class, before a call + // Lock around setOutput ensures that other threads don't + // emit events after setOutput and unregister the event class, before a call // to storeDescriptorInJVM synchronized void setOutput(String filename) { + if (staleMetadata) { + storeDescriptorInJVM(); + } jvm.setOutput(filename); unregisterUnloaded(); if (unregistered) { - staleMetadata = typeLibrary.clearUnregistered(); + if (typeLibrary.clearUnregistered()) { + storeDescriptorInJVM(); + } unregistered = false; } - if (staleMetadata) { - storeDescriptorInJVM(); - } } private void unregisterUnloaded() { -- GitLab