mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-30 14:19:30 +00:00
Merge branch '3.3.x' into 3.4.x
Closes gh-46004
This commit is contained in:
+17
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -46,6 +47,7 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Web {@link Endpoint @Endpoint} to expose heap dumps.
|
||||
@@ -111,12 +113,22 @@ public class HeapDumpWebEndpoint {
|
||||
* @throws HeapDumperUnavailableException if the heap dumper cannot be created
|
||||
*/
|
||||
protected HeapDumper createHeapDumper() throws HeapDumperUnavailableException {
|
||||
try {
|
||||
return new HotSpotDiagnosticMXBeanHeapDumper();
|
||||
}
|
||||
catch (HeapDumperUnavailableException ex) {
|
||||
if (isRunningOnOpenJ9()) {
|
||||
return new OpenJ9DiagnosticsMXBeanHeapDumper();
|
||||
}
|
||||
return new HotSpotDiagnosticMXBeanHeapDumper();
|
||||
}
|
||||
|
||||
private boolean isRunningOnOpenJ9() {
|
||||
String vmName = System.getProperty("java.vm.name");
|
||||
if (StringUtils.hasLength(vmName) && vmName.toLowerCase(Locale.ROOT).contains("openj9")) {
|
||||
return true;
|
||||
}
|
||||
String vmVendor = System.getProperty("java.vm.vendor");
|
||||
if (StringUtils.hasLength(vmVendor) && vmVendor.toLowerCase(Locale.ROOT).contains("openj9")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user