Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 9CBB019F7A75; Wed, 30 Nov 2011 20:55:31 -0400 (AST) Received: from mail63.csoft.net ([205.205.214.4]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RVuvw-0004xO-8z; Thu, 01 Dec 2011 00:55:30 +0000 Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id 04B3C28409; Wed, 30 Nov 2011 19:55:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=rjpPpFnHucrTR/5R3w+t062kjoI=; b=wBMOt/ +mEJnEup0i1H2rI+DiAJW17htJ5FE2mr131VNdStiqOZ8LPv4Uvdbt4OQnwDpxq5 TFt0Rr3wdx71UzmNpeoFYJ1Ork8Clevp/n2HURf2a8bupPnw324elj8Ho1rOIrmM glxybyXB/dnnwqx0lrvQBEVeykH430a/4RK74= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id ABF982841F; Wed, 30 Nov 2011 19:55:14 -0500 (EST) Received: by leary.csoft.net (Postfix, from userid 1112) id 12251A20C; Wed, 30 Nov 2011 19:55:14 -0500 (EST) Date: Wed, 30 Nov 2011 19:55:13 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Joel Jacobson cc: pgsql-hackers@postgresql.org, pgsql-jdbc@postgresql.org Subject: Re: Java LISTEN/NOTIFY client library work-around In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201111/1767 X-Sequence-Number: 199251 On Wed, 30 Nov 2011, Joel Jacobson wrote: > As you know, LISTEN/NOTIFY is broken in the Java client library. You have to > do a SELECT 1 in a while-loop to receive the notifications. > > http://jdbc.postgresql.org/documentation/head/listennotify.html This documentation is out of date. Currently you can get notifications without polling the database if you are not using a SSL connection. You still must poll the driver, using PGConnection.getNotifications, but it will return new notifications received without an intermediate database query. This doesn't work over SSL and potentially some other connection types because it uses InputStream.available that not all implementations support. Kris Jurka