Jdk21Inners

This commit is contained in:
redkale
2024-10-05 21:39:47 +08:00
parent 07eb1386de
commit 154fd08183
2 changed files with 7 additions and 1 deletions

View File

@@ -111,6 +111,6 @@ public class ByteTreeNode<T> {
@Override @Override
public String toString() { public String toString() {
return "ByteTreeNode{" + "index='" + (char) index + "', value=" + value + '}'; return "ByteTreeNode{" + "index='" + (char) index + "', key=" + key + "', value=" + value + '}';
} }
} }

View File

@@ -17,6 +17,11 @@ import java.util.function.Supplier;
*/ */
class Jdk21Inners { class Jdk21Inners {
static {
// 加载时进行可用性判断
Thread.currentThread().isVirtual();
}
private Jdk21Inners() { private Jdk21Inners() {
// do nothing // do nothing
} }
@@ -67,6 +72,7 @@ class Jdk21Inners {
this.supplier = supplier; this.supplier = supplier;
} }
@Override
public ThreadLocal<T> apply(Supplier<T> supplier) { public ThreadLocal<T> apply(Supplier<T> supplier) {
return new VirtualThreadLocal<>(supplier); return new VirtualThreadLocal<>(supplier);
} }