Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 193C3632AD9 for ; Mon, 21 Dec 2009 09:44:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 83791-03 for ; Mon, 21 Dec 2009 13:43:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id E8F5163267D for ; Mon, 21 Dec 2009 09:44:05 -0400 (AST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id C4D031E044D for ; Mon, 21 Dec 2009 21:44:02 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QJTVEeUKVxw6 for ; Mon, 21 Dec 2009 21:44:01 +0800 (WST) Received: from [10.1.1.6] (124-169-133-89.dyn.iinet.net.au [124.169.133.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id BCF241E0450 for ; Mon, 21 Dec 2009 21:44:00 +0800 (WST) Message-ID: <4B2F7BA0.4080106@postnewspapers.com.au> Date: Mon, 21 Dec 2009 21:44:00 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: PG-JDBC Mailing List Subject: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify References: <4B2267A9.1080302@postnewspapers.com.au> <4B2C7A13.9080807@postnewspapers.com.au> <675723c4dae1093da0a64f50ac6327e7@smogura-softworks.eu> <4B2F6999.2050309@postnewspapers.com.au> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.337 tagged_above=-10 required=5 tests=AWL=0.262, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/78 X-Sequence-Number: 20159 (Re-sent, this time to the list) On 21/12/2009 9:13 PM, rsmogura@softperience.pl wrote: > I haven't seen 1.4.2 JDK for ages :), but there is method > javax.net.ssl.SSLSocketFactory.createSocket that takes as the 1st argument > plain socket, there is no need to "forgot" plain socket (and it can be > used, actually it's used for SSL communication with lazy handshake > FTPS/SMTPS...). That's how the PgJDBC driver works - it wraps an existing socket in an SSLSocket when SSL negotiation begins. Pg always begins with a plain text connection - it doesn't have a separate SSL port - so it has to begin with a plaintext connection and then request SSL negotiation using a plaintext message. > Unfortunatly plainSocket can have some available bytes, but sslsoket.read > can return EOF. But this was i saw on SUN JDK is that read(new byte[0]) on > SSL socket causes process plain data. I'm pretty sure it also blocks if there's nothing to read. You'd have to run that in a background thread to force processing of any pending data by the SSL engine. If you're going to do that, you may as well just have a dedicated background thread to do all the reading from the socket... -- Craig Ringer