diff options
author | Chris Cleeland <chris.cleeland@gmail.com> | 1997-04-25 21:39:35 +0000 |
---|---|---|
committer | Chris Cleeland <chris.cleeland@gmail.com> | 1997-04-25 21:39:35 +0000 |
commit | d303d1de1f4d462c26e7e7b42c87469e235f646b (patch) | |
tree | 00139f56d3bba815fc64ca251d82de27b3174bc5 /java/examples/Logger/simple-server | |
parent | 90dae719cf1f847db04d52bd3687115efab4fbd3 (diff) | |
download | ATCD-d303d1de1f4d462c26e7e7b42c87469e235f646b.tar.gz |
Added a BufferedOutputStream layered btw. the DataOutputStream and
logger.outputStream. This allows us to stream all data members of
LogRecord onto the stream individually, then transmit them
simultaneously by flushing the BufferedOutputStream.
Diffstat (limited to 'java/examples/Logger/simple-server')
-rw-r--r-- | java/examples/Logger/simple-server/LoggingClient.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/java/examples/Logger/simple-server/LoggingClient.java b/java/examples/Logger/simple-server/LoggingClient.java index 3c8a7fe3a2e..e6ea986c011 100644 --- a/java/examples/Logger/simple-server/LoggingClient.java +++ b/java/examples/Logger/simple-server/LoggingClient.java @@ -67,7 +67,8 @@ public class LoggingClient implements Runnable // provide a mechanism for changing the type of the filter stream // used (which might be better in the long run...give it the class // id). - DataOutputStream dos = new DataOutputStream((OutputStream) logger.outputStream()); + BufferedOutputStream bos = new BufferedOutputStream((OutputStream) logger.outputStream(), LogRecord.MAXLOGMSGLEN); + DataOutputStream dos = new DataOutputStream(bos); for (int i = 0; i < maxIter_; i++) { @@ -79,6 +80,7 @@ public class LoggingClient implements Runnable { dos.writeInt(rec.length()); rec.streamOutTo(dos); + bos.flush(); rec.print("localhost", true, System.err); } catch (IOException ex) { } |