提交 84c2130a 编写于 作者: C chegar

7098719: -Dsun.net.maxDatagramSockets and Socket constructor does not work...

7098719: -Dsun.net.maxDatagramSockets and Socket constructor does not work correctly with System.gc()
Reviewed-by: michaelm
上级 1f5e9537
......@@ -86,10 +86,11 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
* is a stream socket (true) or an unconnected UDP socket (false).
*/
protected synchronized void create(boolean stream) throws IOException {
fd = new FileDescriptor();
this.stream = stream;
if (!stream) {
ResourceManager.beforeUdpCreate();
// only create the fd after we know we will be able to create the socket
fd = new FileDescriptor();
try {
socketCreate(false);
} catch (IOException ioe) {
......@@ -98,6 +99,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
throw ioe;
}
} else {
fd = new FileDescriptor();
socketCreate(true);
}
if (socket != null)
......
......@@ -70,7 +70,7 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
fd1 = new FileDescriptor();
try {
super.create();
} catch (IOException e) {
} catch (SocketException e) {
fd1 = null;
throw e;
}
......
......@@ -81,7 +81,12 @@ class TwoStacksPlainSocketImpl extends AbstractPlainSocketImpl
*/
protected synchronized void create(boolean stream) throws IOException {
fd1 = new FileDescriptor();
super.create(stream);
try {
super.create();
} catch (IOException e) {
fd1 = null;
throw e;
}
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册