Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9zmE-00080z-0k for pgsql-jdbc@arkaria.postgresql.org; Tue, 30 Jun 2015 17:56:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9zmD-00043Q-Ho for pgsql-jdbc@arkaria.postgresql.org; Tue, 30 Jun 2015 17:56:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9zmC-00042y-IQ for pgsql-jdbc@postgresql.org; Tue, 30 Jun 2015 17:56:56 +0000 Received: from smtprelay02.ispgateway.de ([80.67.18.14]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9zm9-0000WE-40 for pgsql-jdbc@postgresql.org; Tue, 30 Jun 2015 17:56:55 +0000 Received: from [88.66.6.212] (helo=Zauselmaus) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9zm7-0006an-Gk for pgsql-jdbc@postgresql.org; Tue, 30 Jun 2015 19:56:51 +0200 From: "Markus KARG" To: "'List'" References: <011501d0b357$26f1eca0$74d5c5e0$@eu> <3A641C7E-04D2-4554-8CDC-37A11E0178AB@gmail.com> In-Reply-To: <3A641C7E-04D2-4554-8CDC-37A11E0178AB@gmail.com> Subject: Re: Adding new dependencies for in-core Date: Tue, 30 Jun 2015 19:56:52 +0200 Organization: Markus KARG, Staatl. gepr. Inf. Message-ID: <013001d0b35e$253ae9a0$6fb0bce0$@eu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdCzV4Ky84jgmR2VRvuGlVkrH7LqbAABh01w Content-Language: de X-AVK-Virus-Check: AVA 25.2250;789163EA X-AVK-Spam-Check: 1; str=0001.0A0C0205.5592D863.0103,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0; F1206 X-Df-Sender: bWFya3VzQGhlYWRjcmFzaGluZy5ldQ== X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org I see. Just to throw in a different idea: Possibly we might need caches in other places too at a later time, so maybe we might like to apply strategy design pattern instead of becoming directly dependent of one particular class? I mean, it is nice that the linked hash map actually implies LRU, but if we want LRU, it might be a better design choice, to explicitly model this as a class "LruCacheStrategy" which allows us to even configure or replace the strategy later? -----Original Message----- From: Steven Schlansker [mailto:stevenschlansker@gmail.com] Sent: Dienstag, 30. Juni 2015 19:09 To: Markus KARG Cc: List Subject: Re: [JDBC] Adding new dependencies for in-core It is a Concurrent *Linked* HashMap, which presumably facilitates LRU removal. On Jun 30, 2015, at 10:06 AM, Markus KARG wrote: > Vladimir, > > sorry for being so ingorant not to give it a deeper thought, but what is in CLHM what is not also in java.util.concurrent.ConcurrentHashMap? > > -Markus > > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Vladimir Sitnikov > Sent: Dienstag, 30. Juni 2015 14:21 > To: List > Subject: [JDBC] Adding new dependencies for in-core > > Hi, > > I've had a quick look into https://github.com/pgjdbc/pgjdbc/issues/345 > (Share parsed query texts across different connections) and it looks like https://github.com/ben-manes/concurrentlinkedhashmap would be useful to implement the cache. > > We don't need all the stuff CLHM has, but I see no easy&scalable way of doing concurrent map with eviction by mere java.util.concurrent stuff. > > Well, I can do lock splitting (i.e. use multiple small LRU caches instead of a single big cache), however that looks like reinventing the wheel. > > Can you suggest what is the best way of adding CLHM dependency? > Should it be added in plain? > Should it be shaded? (i.e. renamed to org.postgresql.clhm...) > > I'm more inclined to the "add regular dependency" approach. > > I expect similar question might appear if we consider using netty for IO. > > -- > Regards, > Vladimir Sitnikov > > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc > > > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc