Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TOpWx-0005LC-H2 for pgsql-jdbc@postgresql.org; Thu, 18 Oct 2012 12:48:55 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TOpWr-0000OR-DL for pgsql-jdbc@postgresql.org; Thu, 18 Oct 2012 12:48:55 +0000 Received: by mail-pa0-f46.google.com with SMTP id hz1so8269442pad.19 for ; Thu, 18 Oct 2012 05:48:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=+EbL4KpgzmE4+h47xCe4haQTS99ARV1x2e74OI7ZO1o=; b=kWgkpoeVpwLo8aBI73fpsiUke5dOp0/xZrTQc7MXN122xX5rmmF7IZJ2H0a6QArvUf 7vPhfaPsTnkKhXabUDV1NUteOn5Ny6ZcZzBLOsyf5fPzofQWfBOoY5znIy0vRmzsWwJO uWfpOWTk1Vwnbmsio5DhUIUy5FCDxt6/Nr2hGfzJHbVreHwLgztlfXfaUR6oJoaPeQv7 xIeVcN/Qf41Pq5w3ukX+zM6tPbwnEIzuo+9tIbvIZ6Z3MYSx2jx3k1Z0FszxZEv1uEwb rQB9nKh7Zzz36QBP8XW6YSLEInV7Dns0smddiI/+SXmg+wAqzF0O0OaL9y+aR/MN3viW hFYA== Received: by 10.68.233.230 with SMTP id tz6mr65560478pbc.36.1350564527554; Thu, 18 Oct 2012 05:48:47 -0700 (PDT) Received: from ayaki.localdomain (124-148-78-49.dyn.iinet.net.au. [124.148.78.49]) by mx.google.com with ESMTPS id o1sm14329243paz.34.2012.10.18.05.48.44 (version=SSLv3 cipher=OTHER); Thu, 18 Oct 2012 05:48:46 -0700 (PDT) Message-ID: <507FFAA9.3060902@ringerc.id.au> Date: Thu, 18 Oct 2012 20:48:41 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 MIME-Version: 1.0 To: Dave Cramer CC: Mikko Tiihonen , =?ISO-8859-1?Q?S=E9rgio_Saquetim?= , "pgsql-jdbc@postgresql.org" , Rafael dos Santos Silva Subject: Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver References: <507FC5EA.6070905@ringerc.id.au> <51061EFB789B4A45AC6598C83649B7BE8DB56604@NBL-EXCD1-01.nebula.local> <507FF3A2.4040306@ringerc.id.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmaakPcpB0PgZRNujeRh+6ds8znvdXRUOAMr5xMMiMTQ8VrF7rMSK7CqDKCwyzx8C31rE+M X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/81 X-Sequence-Number: 23405 On 10/18/2012 08:43 PM, Dave Cramer wrote: > On Thu, Oct 18, 2012 at 8:18 AM, Craig Ringer wrote: >> On 10/18/2012 05:17 PM, Mikko Tiihonen wrote: >>> >>> I think the DNS lookup is part of the JDBC failover connection patch that >>> I created. >>> I initially used a InetSocketAddress.getHostString() that does not do any >>> DNS lookups, but since that method was added in Java7 I had to revert to >>> getHostName() method which does. >>> >>> I see following options: >> >> >> 0) Revert the JDBC failover patch or require a connection parameter to >> enable it >> >> >>> 1) modify the code so that is uses reflection and if Java7 is detected it >>> will use the no-lookup method >> >> >> Gah! no! Not only will this not work in most SecurityManager contexts, but >> it's slow and horrid. > > Surely there must be a way to detect that you are on Java7 without reflection ? Detect, trivially, but if code that refers to a method that doesn't exist in Java 7 is loaded it'll cause a link error from memory - so you can't actually get to the point where you test the condition when running in Java 6. I'll write a toy test class to confirm that and check back. -- Craig Ringer