9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/paper-patches/features/0026-Virtual-thread-support.patch
2025-04-07 11:35:31 -04:00

36 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 9 Aug 2023 15:04:56 +0200
Subject: [PATCH] Virtual thread support
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 119d26ada18ad1451b893657a1c9fa3bc2be6be4..8685b42dd00c964b0fbf42334cd6d23f187b2658 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -976,6 +976,22 @@ public class Metrics {
}));
// Gale end - SIMD support - include in metrics
+ // Gale start - virtual thread support - include in metrics
+ Map<String, Map<String, Integer>> virtualThreadSupportMap = new HashMap<>(2);
+ {
+ Map<String, Integer> entry = new HashMap<>(2);
+ boolean isSupported = org.galemc.gale.virtualthread.VirtualThreadService.isSupported();
+ try {
+ int javaMajorVersion = org.galemc.gale.virtualthread.VirtualThreadService.getJavaMajorVersion();
+ entry.put(isSupported + " (Java " + javaMajorVersion + ")", 1);
+ } catch (Exception ignored) {
+ entry.put(String.valueOf(isSupported), 1);
+ }
+ virtualThreadSupportMap.put(String.valueOf(isSupported), entry);
+ }
+ metrics.addCustomChart(new Metrics.DrilldownPie("virtual_thread_support", () -> virtualThreadSupportMap));
+ // Gale end - virtual thread support - include in metrics
+
}
}