diff options
author | jfrijters <jfrijters> | 2013-08-15 18:27:57 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2013-08-15 18:27:57 +0400 |
commit | f4419eda6439fb82d6f4266dfa069d32af5b0348 (patch) | |
tree | ac580fdf9197f96857b9245ae7547aa8ad018290 /openjdk/java | |
parent | 898e1dedc210a812829c5914249389c7d159bfb3 (diff) |
Merged in IoTrace hooks.
Diffstat (limited to 'openjdk/java')
-rw-r--r-- | openjdk/java/net/SocketInputStream.java | 10 | ||||
-rw-r--r-- | openjdk/java/net/SocketOutputStream.java | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/openjdk/java/net/SocketInputStream.java b/openjdk/java/net/SocketInputStream.java index 830fa51c..161947cc 100644 --- a/openjdk/java/net/SocketInputStream.java +++ b/openjdk/java/net/SocketInputStream.java @@ -32,6 +32,7 @@ import java.nio.channels.FileChannel; import static ikvm.internal.Winsock.*; import static java.net.net_util_md.*; +import sun.misc.IoTrace; import sun.net.ConnectionResetException; /** @@ -41,7 +42,6 @@ import sun.net.ConnectionResetException; * * @author Jonathan Payne * @author Arthur van Hoff - * @author Jeroen Frijters */ class SocketInputStream extends FileInputStream { @@ -182,7 +182,7 @@ class SocketInputStream extends FileInputStream } int read(byte b[], int off, int length, int timeout) throws IOException { - int n; + int n = 0; // EOF already encountered if (eof) { @@ -204,6 +204,7 @@ class SocketInputStream extends FileInputStream boolean gotReset = false; + Object traceContext = IoTrace.socketReadBegin(); // acquire file descriptor and do the read FileDescriptor fd = impl.acquireFD(); try { @@ -215,6 +216,8 @@ class SocketInputStream extends FileInputStream gotReset = true; } finally { impl.releaseFD(); + IoTrace.socketReadEnd(traceContext, impl.address, impl.port, + timeout, n > 0 ? n : 0); } /* @@ -222,6 +225,7 @@ class SocketInputStream extends FileInputStream * buffered on the socket */ if (gotReset) { + traceContext = IoTrace.socketReadBegin(); impl.setConnectionResetPending(); impl.acquireFD(); try { @@ -232,6 +236,8 @@ class SocketInputStream extends FileInputStream } catch (ConnectionResetException rstExc) { } finally { impl.releaseFD(); + IoTrace.socketReadEnd(traceContext, impl.address, impl.port, + timeout, n > 0 ? n : 0); } } diff --git a/openjdk/java/net/SocketOutputStream.java b/openjdk/java/net/SocketOutputStream.java index 9e6be018..fd6e2c4f 100644 --- a/openjdk/java/net/SocketOutputStream.java +++ b/openjdk/java/net/SocketOutputStream.java @@ -32,6 +32,8 @@ import java.nio.channels.FileChannel; import static ikvm.internal.Winsock.*; import static java.net.net_util_md.*; +import sun.misc.IoTrace; + /** * This stream extends FileOutputStream to implement a * SocketOutputStream. Note that this class should <b>NOT</b> be @@ -39,7 +41,6 @@ import static java.net.net_util_md.*; * * @author Jonathan Payne * @author Arthur van Hoff - * @author Jeroen Frijters */ class SocketOutputStream extends FileOutputStream { @@ -176,9 +177,12 @@ class SocketOutputStream extends FileOutputStream throw new ArrayIndexOutOfBoundsException(); } + Object traceContext = IoTrace.socketWriteBegin(); + int bytesWritten = 0; FileDescriptor fd = impl.acquireFD(); try { socketWrite0(fd, b, off, len); + bytesWritten = len; } catch (SocketException se) { if (se instanceof sun.net.ConnectionResetException) { impl.setConnectionResetPending(); @@ -191,6 +195,7 @@ class SocketOutputStream extends FileOutputStream } } finally { impl.releaseFD(); + IoTrace.socketWriteEnd(traceContext, impl.address, impl.port, bytesWritten); } } |