pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Simple connection failover support
Date: Sun, 03 Jun 2012 20:10:05 +0300
Message-ID: <4FCB9A6D.2040407@nitorcreations.com> (raw)
In-Reply-To: <CADK3HH+He5hBL6oB9gOUhNiuW2RRirnpJA7xKwqv9hTM5duDaA@mail.gmail.com>
References: <4FBB9691.50008@nitorcreations.com>
	<CADK3HH+He5hBL6oB9gOUhNiuW2RRirnpJA7xKwqv9hTM5duDaA@mail.gmail.com>

On 06/02/2012 01:00 AM, Dave Cramer wrote:
> Mikko,
>
> I get compile errors
>
> getHostString() is not public in java.net.InetSocketAddress; cannot be
> accessed from outside package
>
> compiling with java 6

Seems I slipped one Java7 method call in. Comparing the implementations it seems
in this case the InetSocketAddress.getHostName() will result in exactly the same
result.

I had selected the getHostString method because it tried to avoid dns lookups.
But the few places where I used it we were either opening the socket or initiating
ssl on already open socket so the lookup is either needed any way or already done
respectively.

Can change the method to getHostName? Or should I send a revised patch?

-Mikko
> >
> On Tue, May 22, 2012 at 9:37 AM, Mikko Tiihonen
> <mikko.tiihonen@nitorcreations.com>  wrote:
>> Hi,
>>
>> Here are two patches that add simple failover support to the jdbc driver.
>>
>> Patch 1 converts all references to pair of host+port variables to single
>> InetSocketAddress
>> Patch 2 rewrites the url parsing to support multiple host:port pairs and
>> modifies the low level connection opening to retry once all listed addresses
>> I also added more cases to the unit tests to verify that I did not break any
>> functionality.
>>
>> * The connection url and connection parameters stay backwards compatible
>> * If there are commas in the hostname part of the url the new code will use
>> them to split the addresses and keep them in the defined priority order
>> * If there is any IOException or login failure during the connection phase
>> the code will try another listed address
>> * I tried to keep the code still Java 1.4 compatible
>>
>> -Mikko



view thread (5+ messages)  latest in thread

Message-ID: <4FCB9A6D.2040407@nitorcreations.com>
Permalink:  ../4FCB9A6D.2040407@nitorcreations.com/
Also on:    postgresql.org/message-id/4FCB9A6D.2040407@nitorcreations.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: mikko.tiihonen@nitorcreations.com, pg@fastcrypt.com
  Subject: Re: Simple connection failover support
  In-Reply-To: <4FCB9A6D.2040407@nitorcreations.com>
  References: <4FBB9691.50008@nitorcreations.com> <CADK3HH+He5hBL6oB9gOUhNiuW2RRirnpJA7xKwqv9hTM5duDaA@mail.gmail.com> <4FCB9A6D.2040407@nitorcreations.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