Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 471391B7B373 for ; Sun, 3 Jun 2012 14:10:28 -0300 (ADT) Received: from auth-smtp.nebula.fi ([217.30.180.105]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SbEJs-0001vw-Bb for pgsql-jdbc@postgresql.org; Sun, 03 Jun 2012 17:10:27 +0000 Received: from quadvadis.localdomain (gw.nitor.fi [83.145.228.24]) (authenticated bits=0) by auth-smtp.nebula.fi (8.13.8/8.13.4) with ESMTP id q53HA5EM028965 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 3 Jun 2012 20:10:06 +0300 Message-ID: <4FCB9A6D.2040407@nitorcreations.com> Date: Sun, 03 Jun 2012 20:10:05 +0300 From: Mikko Tiihonen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Dave Cramer CC: pgsql-jdbc@postgresql.org Subject: Re: Simple connection failover support References: <4FBB9691.50008@nitorcreations.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201206/14 X-Sequence-Number: 23008 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 > 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