pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philippe Ebersohl <philippe.ebersohl@dalim.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: A method to asynchronously LISTEN ?
Date: Wed, 27 Feb 2019 11:47:48 +0100 (CET)
Message-ID: <1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com> (raw)
In-Reply-To: <CAKFQuwb_32MwN6SkMW=3pLQ=Y2e7zhteUsGJPvm_um0PCp+gAw@mail.gmail.com>
References: <1058674020.3669693.1550249725415.JavaMail.zimbra@dalim.com>
	<CADK3HH+bB96W_6Qiyd=+iU3rNvdo=jsbcYN=GvRjZo4MNbuxPA@mail.gmail.com>
	<1855336325.5176233.1551086100885.JavaMail.zimbra@dalim.com>
	<CADK3HHLM2CX5QVfCoZ7D5B688twxOPys2ZMNtDXja-fKqe_kLg@mail.gmail.com>
	<CAKFQuwb2uiVJ_wzYUf9aGG3e3CYTu3ZB4JiWhZeP=Qs0tsL8tw@mail.gmail.com>
	<CADK3HHLzb2RjFc7T_ccJ0nhC6Gx457TCGu0==YtVNWXcG=xsrw@mail.gmail.com>
	<CAKFQuwb_32MwN6SkMW=3pLQ=Y2e7zhteUsGJPvm_um0PCp+gAw@mail.gmail.com>

Hello, 
I do not think there is a need for something like conn.listenSync(). 
We were just intrigued about the test. 

In fact the current proposition should just work fine and we would like to test it. 
How could we have access to a postgresql-*.jdbc.jar that includes this feature ? 

Regards, 
Philippe 



From: "David G. Johnston" <david.g.johnston@gmail.com> 
To: "Dave Cramer" <pg@fastcrypt.com> 
Cc: "Philippe Ebersohl" <philippe.ebersohl@dalim.com>, "List" <pgsql-jdbc@postgresql.org> 
Sent: Tuesday, 26 February, 2019 22:17:12 
Subject: Re: A method to asynchronously LISTEN ? 

On Tue, Feb 26, 2019 at 12:04 PM Dave Cramer < pg@fastcrypt.com > wrote: 





On Tue, 26 Feb 2019 at 12:29, David G. Johnston < david.g.johnston@gmail.com > wrote: 

BQ_BEGIN

The question being asked is whether executeUpdate method performs synchronous execution of the listener function queue during its execution. 

This after sending the command to the server and the server completing execution of the NOTIFY. This assumes that the server places the notification on the channel for pick-up immediately (which will not be the case within a transaction). 

While the client is, IIRC, synchronous, thus the local order of operations can be controlled, the server is asynchronous and thus this test is exposed to timing issues. Maybe we need something like conn.listenSync() that blocks until a notification payload is received on the connection...? 



kind of defeats the asynchronous aspect, no ? 

BQ_BEGIN


BQ_BEGIN


BQ_BEGIN



BQ_END


BQ_END


BQ_END


BQ_END

You'd still want an asynchronous API for people but JavaScript introduced the "async/await" feature for a reason. In this case making it "sync" instead of coding up wait loop seems desirable. That said its quite possible I'm missing some existing feature as I haven't used this API at all. 

David J. 

view thread (16+ messages)  latest in thread

Message-ID: <1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com>
Permalink:  ../1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com/
Also on:    postgresql.org/message-id/1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: philippe.ebersohl@dalim.com, david.g.johnston@gmail.com, pg@fastcrypt.com
  Subject: Re: A method to asynchronously LISTEN ?
  In-Reply-To: <1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com>
  References: <1058674020.3669693.1550249725415.JavaMail.zimbra@dalim.com> <CADK3HH+bB96W_6Qiyd=+iU3rNvdo=jsbcYN=GvRjZo4MNbuxPA@mail.gmail.com> <1855336325.5176233.1551086100885.JavaMail.zimbra@dalim.com> <CADK3HHLM2CX5QVfCoZ7D5B688twxOPys2ZMNtDXja-fKqe_kLg@mail.gmail.com> <CAKFQuwb2uiVJ_wzYUf9aGG3e3CYTu3ZB4JiWhZeP=Qs0tsL8tw@mail.gmail.com> <CADK3HHLzb2RjFc7T_ccJ0nhC6Gx457TCGu0==YtVNWXcG=xsrw@mail.gmail.com> <CAKFQuwb_32MwN6SkMW=3pLQ=Y2e7zhteUsGJPvm_um0PCp+gAw@mail.gmail.com> <1000052273.5516163.1551264468429.JavaMail.zimbra@dalim.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox