提交 f421875b 编写于 作者: B bpb

8062501: Modifications of server socket channel accept() methods for instrumentation purposes

Summary: Wrap accept0() native methods in Java accept().
Reviewed-by: chegar, alanb
上级 06a7c479
...@@ -247,7 +247,7 @@ class ServerSocketChannelImpl ...@@ -247,7 +247,7 @@ class ServerSocketChannelImpl
return null; return null;
thread = NativeThread.current(); thread = NativeThread.current();
for (;;) { for (;;) {
n = accept0(this.fd, newfd, isaa); n = accept(this.fd, newfd, isaa);
if ((n == IOStatus.INTERRUPTED) && isOpen()) if ((n == IOStatus.INTERRUPTED) && isOpen())
continue; continue;
break; break;
...@@ -410,6 +410,18 @@ class ServerSocketChannelImpl ...@@ -410,6 +410,18 @@ class ServerSocketChannelImpl
return sb.toString(); return sb.toString();
} }
/**
* Accept a connection on a socket.
*
* @implNote Wrap native call to allow instrumentation.
*/
private int accept(FileDescriptor ssfd, FileDescriptor newfd,
InetSocketAddress[] isaa)
throws IOException
{
return accept0(ssfd, newfd, isaa);
}
// -- Native methods -- // -- Native methods --
// Accepts a new connection, setting the given file descriptor to refer to // Accepts a new connection, setting the given file descriptor to refer to
......
...@@ -141,7 +141,7 @@ class UnixAsynchronousServerSocketChannelImpl ...@@ -141,7 +141,7 @@ class UnixAsynchronousServerSocketChannelImpl
Throwable exc = null; Throwable exc = null;
try { try {
begin(); begin();
int n = accept0(this.fd, newfd, isaa); int n = accept(this.fd, newfd, isaa);
// spurious wakeup, is this possible? // spurious wakeup, is this possible?
if (n == IOStatus.UNAVAILABLE) { if (n == IOStatus.UNAVAILABLE) {
...@@ -277,7 +277,7 @@ class UnixAsynchronousServerSocketChannelImpl ...@@ -277,7 +277,7 @@ class UnixAsynchronousServerSocketChannelImpl
try { try {
begin(); begin();
int n = accept0(this.fd, newfd, isaa); int n = accept(this.fd, newfd, isaa);
if (n == IOStatus.UNAVAILABLE) { if (n == IOStatus.UNAVAILABLE) {
// need calling context when there is security manager as // need calling context when there is security manager as
...@@ -332,6 +332,18 @@ class UnixAsynchronousServerSocketChannelImpl ...@@ -332,6 +332,18 @@ class UnixAsynchronousServerSocketChannelImpl
} }
} }
/**
* Accept a connection on a socket.
*
* @implNote Wrap native call to allow instrumentation.
*/
private int accept(FileDescriptor ssfd, FileDescriptor newfd,
InetSocketAddress[] isaa)
throws IOException
{
return accept0(ssfd, newfd, isaa);
}
// -- Native methods -- // -- Native methods --
private static native void initIDs(); private static native void initIDs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册