mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8325949: Create an internal utility method for creating VarHandle instances
Reviewed-by: rriggs
This commit is contained in:
parent
67448b0eb2
commit
384deda65f
31 changed files with 232 additions and 317 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2024, 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
|
||||
|
@ -34,6 +34,7 @@ import java.util.Objects;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.invoke.MhUtil;
|
||||
import jdk.internal.vm.ContinuationSupport;
|
||||
|
||||
/**
|
||||
|
@ -273,15 +274,9 @@ class ThreadBuilders {
|
|||
* Base ThreadFactory implementation.
|
||||
*/
|
||||
private abstract static class BaseThreadFactory implements ThreadFactory {
|
||||
private static final VarHandle COUNT;
|
||||
static {
|
||||
try {
|
||||
MethodHandles.Lookup l = MethodHandles.lookup();
|
||||
COUNT = l.findVarHandle(BaseThreadFactory.class, "count", long.class);
|
||||
} catch (Exception e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
private static final VarHandle COUNT = MhUtil.findVarHandle(
|
||||
MethodHandles.lookup(), "count", long.class);
|
||||
|
||||
private final String name;
|
||||
private final int characteristics;
|
||||
private final UncaughtExceptionHandler uhe;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue