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

Print this page
rev 5501 : imported patch io-trace

*** 32,41 **** --- 32,43 ---- import java.nio.channels.*; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.util.*; + import sun.misc.IoTrace; + // 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
*** 202,213 **** // Implement timeout with a selector SelectionKey sk = null; Selector sel = null; sc.configureBlocking(false); try { - int n; if ((n = sc.read(bb)) != 0) return n; sel = Util.getTemporarySelector(sc); sk = sc.register(sel, SelectionKey.OP_READ); long to = timeout; --- 204,216 ---- // Implement timeout with a selector SelectionKey sk = null; Selector sel = null; sc.configureBlocking(false); + int n = 0; + Object traceContext = IoTrace.socketReadBegin(getInetAddress(), getPort(), timeout); try { if ((n = sc.read(bb)) != 0) return n; sel = Util.getTemporarySelector(sc); sk = sc.register(sel, SelectionKey.OP_READ); long to = timeout;
*** 224,233 **** --- 227,237 ---- to -= System.currentTimeMillis() - st; if (to <= 0) throw new SocketTimeoutException(); } } finally { + IoTrace.socketReadEnd(traceContext, n > 0 ? n : 0); if (sk != null) sk.cancel(); if (sc.isOpen()) sc.configureBlocking(true); if (sel != null)