Skip to content

Commit

Permalink
8344184: Remove sun.net.ResourceManager after JEP 486 integration
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuch committed Nov 26, 2024
1 parent f0b72f7 commit 553ddec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 109 deletions.
84 changes: 0 additions & 84 deletions src/java.base/share/classes/sun/net/ResourceManager.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
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;

Expand Down Expand Up @@ -194,7 +193,6 @@ class DatagramChannelImpl
FileDescriptor fd = null;
NativeSocketAddress[] sockAddrs = null;

ResourceManager.beforeUdpCreate();
boolean initialized = false;
try {
this.interruptible = interruptible;
Expand All @@ -217,7 +215,6 @@ class DatagramChannelImpl
if (!initialized) {
if (sockAddrs != null) NativeSocketAddress.freeAll(sockAddrs);
if (fd != null) nd.close(fd);
ResourceManager.afterUdpClose();
}
}

Expand All @@ -232,7 +229,6 @@ class DatagramChannelImpl

NativeSocketAddress[] sockAddrs = null;

ResourceManager.beforeUdpCreate();
boolean initialized = false;
try {
this.interruptible = true;
Expand All @@ -257,7 +253,6 @@ class DatagramChannelImpl
if (!initialized) {
if (sockAddrs != null) NativeSocketAddress.freeAll(sockAddrs);
nd.close(fd);
ResourceManager.afterUdpClose();
}
}

Expand Down Expand Up @@ -1909,8 +1904,7 @@ private static Runnable releaserFor(FileDescriptor fd, NativeSocketAddress... so
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
} finally {
// decrement socket count and release memory
ResourceManager.afterUdpClose();
// release memory
NativeSocketAddress.freeAll(sockAddrs);
}
};
Expand Down
24 changes: 6 additions & 18 deletions src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
Expand Down Expand Up @@ -57,7 +57,6 @@
import sun.net.ConnectionResetException;
import sun.net.NetHooks;
import sun.net.PlatformSocketImpl;
import sun.net.ResourceManager;
import sun.net.ext.ExtendedSocketOptions;
import sun.net.util.SocketExceptions;

Expand Down Expand Up @@ -455,20 +454,12 @@ protected void create(boolean stream) throws IOException {
synchronized (stateLock) {
if (state != ST_NEW)
throw new IOException("Already created");
if (!stream)
ResourceManager.beforeUdpCreate();
FileDescriptor fd;
try {
if (server) {
assert stream;
fd = Net.serverSocket(true);
} else {
fd = Net.socket(stream);
}
} catch (IOException ioe) {
if (!stream)
ResourceManager.afterUdpClose();
throw ioe;
if (server) {
assert stream;
fd = Net.serverSocket(true);
} else {
fd = Net.socket(stream);
}
Runnable closer = closerFor(fd, stream);
this.fd = fd;
Expand Down Expand Up @@ -1221,9 +1212,6 @@ private static Runnable closerFor(FileDescriptor fd, boolean stream) {
nd.close(fd);
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
} finally {
// decrement
ResourceManager.afterUdpClose();
}
};
}
Expand Down

0 comments on commit 553ddec

Please sign in to comment.