Re: about monitoring the input stream - Mailing list pgsql-jdbc

From Marc Herbert
Subject Re: about monitoring the input stream
Date
Msg-id khju03d6trn.fsf@meije.emic.fr
Whole thread Raw
In response to about monitoring the input stream  (Albert Cardona <acardona@ini.phys.ethz.ch>)
List pgsql-jdbc
Albert Cardona <acardona@ini.phys.ethz.ch> writes:

> Following up from
> http://archives.postgresql.org/pgsql-jdbc/2006-07/msg00052.php
> I wonder if anything has been done on the subject of monitoring the amount of
> bytes since the last query?
>
> Finally I've digged into the code and put my hands through reflection on the
> InputStream encapsulated in the PGStream. Problem is, the stream is emptied
> frequently and I can't find the class responsible for reading it out, so my
> readings of the available() bytes (in a monitoring thread) underestimate
> tremendously the amount of bytes actually piped.

Why don't you decorate the InputStream with some simple
CountingInputStream of yours, just like Oliver suggested?

Something very similar to:
 private java.io.DataOutputStream#incCount()

If you are lazy you could even extend BufferInputStream; like this
you have just two read methods to override.


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Set of cursors from database
Next
From: Albert Cardona
Date:
Subject: Re: about monitoring the input stream