X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3E53D9FA380 for ; Wed, 13 Sep 2006 13:46:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 56700-09 for ; Wed, 13 Sep 2006 13:46:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id D36DC9FA0CC for ; Wed, 13 Sep 2006 13:46:01 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 13 Sep 2006 09:45:59 -0700 Subject: Re: about monitoring the input stream From: Mark Lewis To: Albert Cardona Cc: pgsql-jdbc@postgresql.org In-Reply-To: <200609131809.55435.acardona@ini.phys.ethz.ch> References: <200609131809.55435.acardona@ini.phys.ethz.ch> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Wed, 13 Sep 2006 09:45:59 -0700 Message-Id: <1158165959.9657.1259.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.204 tagged_above=0 required=5 tests=AWL, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200609/47 X-Sequence-Number: 15765 If you're trying to add diagnostic data collection to all sockets you could provide a custom SocketFactory implementation which returned wrappers around Sockets that return CountingInputStream objects instead of regular InputStream objects to the getInputStream() method. I don't think that the PG JDBC driver allows you to specify a custom socketFactory, but you could always set the default system socket factory. If you do other network operations in the same JVM, your factory could be smart enough to ignore sockets that don't connect to your PG server/port. -- Mark Lewis On Wed, 2006-09-13 at 18:09 +0200, Albert Cardona wrote: > Marc, > > > 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. > > > The idea is not to modify the driver one bit in benefit of uncontroversial > deployment of my application (TrakEM2 at > http://www.ini.unizh.ch/~acardona/trackem2.html ). If java was lisp I would > simply alter the register to replace the InputStream, but it isn't and/or I > don't know how to use reflection to that extent (I don't know what would > happen was I to replace the InputStream using reflection once a connection > has been created). > > Therefore I ask for suggestions on how to monitor the downloading rate ... > If there aren't any, well, tough luck! I'll have to live with it. > > Albert > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings