Skip site navigation (1) Skip section navigation (2)

Re: Java LISTEN/NOTIFY client library work-around

From: Kris Jurka <books(at)ejurka(dot)com>
To: Joel Jacobson <joel(at)gluefinance(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Java LISTEN/NOTIFY client library work-around
Date: 2011-12-01 00:55:13
Message-ID: alpine.BSO.2.00.1111301949410.22157@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc

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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-12-01 03:29:03
Subject: Re: Accounting for toast in query planner. (gin/gist indexes).
Previous:From: Andrew DunstanDate: 2011-12-01 00:06:52
Subject: Re: Review of VS 2010 support patches

pgsql-jdbc by date

Next:From: bhtDate: 2011-12-01 07:58:40
Subject: Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Previous:From: Craig RingerDate: 2011-11-30 23:46:47
Subject: Re: Bug when retrieving money datatype.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group