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
|
@ -68,13 +68,13 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.access.JavaNioAccess;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.internal.ref.CleanerFactory;
|
||||
import jdk.internal.invoke.MhUtil;
|
||||
import sun.net.ResourceManager;
|
||||
import sun.net.ext.ExtendedSocketOptions;
|
||||
import sun.net.util.IPAddressUtil;
|
||||
|
@ -149,15 +149,8 @@ class DatagramChannelImpl
|
|||
private InetSocketAddress initialLocalAddress;
|
||||
|
||||
// Socket adaptor, created lazily
|
||||
private static final VarHandle SOCKET;
|
||||
static {
|
||||
try {
|
||||
MethodHandles.Lookup l = MethodHandles.lookup();
|
||||
SOCKET = l.findVarHandle(DatagramChannelImpl.class, "socket", DatagramSocket.class);
|
||||
} catch (Exception e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
private static final VarHandle SOCKET = MhUtil.findVarHandle(
|
||||
MethodHandles.lookup(), "socket", DatagramSocket.class);
|
||||
private volatile DatagramSocket socket;
|
||||
|
||||
// Multicast support
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue