src/share/classes/sun/nio/ch/SocketAdaptor.java

Print this page
rev 6099 : [mq]: io-trace

*** 32,41 **** --- 32,44 ---- import java.nio.channels.*; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.util.*; + import sun.misc.IoTrace; + import sun.misc.IoTraceContext; + // Make a socket channel look like a socket. // // The only aspects of java.net.Socket-hood that we don't attempt to emulate // here are the interrupted-I/O exceptions (which our Solaris implementations
*** 189,202 **** throw new IllegalBlockingModeException(); if (timeout == 0) return sc.read(bb); sc.configureBlocking(false); try { ! int n; ! if ((n = sc.read(bb)) != 0) return n; long to = timeout; for (;;) { if (!sc.isOpen()) throw new ClosedChannelException(); long st = System.currentTimeMillis(); --- 192,207 ---- throw new IllegalBlockingModeException(); if (timeout == 0) return sc.read(bb); sc.configureBlocking(false); + int n = 0; + IoTraceContext traceContext = IoTrace.socketReadBegin(getInetAddress(), getPort(), timeout); try { ! if ((n = sc.read(bb)) != 0) { return n; + } long to = timeout; for (;;) { if (!sc.isOpen()) throw new ClosedChannelException(); long st = System.currentTimeMillis();
*** 208,217 **** --- 213,223 ---- to -= System.currentTimeMillis() - st; if (to <= 0) throw new SocketTimeoutException(); } } finally { + IoTrace.socketReadEnd(traceContext, n > 0 ? n : 0); if (sc.isOpen()) sc.configureBlocking(true); } }