--- old/src/share/classes/java/net/SocketInputStream.java 2012-11-13 10:47:54.000000000 +0100 +++ new/src/share/classes/java/net/SocketInputStream.java 2012-11-13 10:47:54.000000000 +0100 @@ -30,6 +30,8 @@ import java.io.IOException; import java.nio.channels.FileChannel; +import sun.misc.IoTrace; +import sun.misc.IoTraceContext; import sun.net.ConnectionResetException; /** @@ -122,7 +124,7 @@ } int read(byte b[], int off, int length, int timeout) throws IOException { - int n; + int n = 0; // EOF already encountered if (eof) { @@ -144,6 +146,7 @@ boolean gotReset = false; + IoTraceContext traceContext = IoTrace.socketReadBegin(impl.address, impl.port, timeout); // acquire file descriptor and do the read FileDescriptor fd = impl.acquireFD(); try { @@ -155,6 +158,7 @@ gotReset = true; } finally { impl.releaseFD(); + IoTrace.socketReadEnd(traceContext, n > 0 ? n : 0); } /* @@ -162,6 +166,7 @@ * buffered on the socket */ if (gotReset) { + traceContext = IoTrace.socketReadBegin(impl.address, impl.port, timeout); impl.setConnectionResetPending(); impl.acquireFD(); try { @@ -172,6 +177,7 @@ } catch (ConnectionResetException rstExc) { } finally { impl.releaseFD(); + IoTrace.socketReadEnd(traceContext, n > 0 ? n : 0); } }