Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AD9926B1F for ; Sat, 11 Jun 2011 11:26:47 +0000 (UTC) Received: (qmail 68272 invoked by uid 500); 11 Jun 2011 11:26:47 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 68202 invoked by uid 500); 11 Jun 2011 11:26:47 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 68194 invoked by uid 99); 11 Jun 2011 11:26:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Jun 2011 11:26:47 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Charles_Honton@intuit.com designates 12.149.175.12 as permitted sender) Received: from [12.149.175.12] (HELO mail2.intuit.com) (12.149.175.12) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Jun 2011 11:26:42 +0000 DomainKey-Signature: s=default; d=intuit.com; c=nofws; q=dns; h=X-SBRS:X-IronPort-AV:Received:Received:Received:Received: From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID: In-Reply-To:Accept-Language:Content-Language: X-MS-Has-Attach:X-MS-TNEF-Correlator:user-agent: x-originating-ip:Content-Type:Content-ID: Content-Transfer-Encoding:MIME-Version:Return-Path: X-OriginalArrivalTime:X-OriginalArrivalTime; b=PbzVB4ypf4Fho6UvaYdeoWFcQgE+HJYTzqWWcUFB7ZC0e89c2NmR+scd tnIH3yhraO1a22MglPGTnK+6d/IGwRtL6/7huLueEthK1ICRab6F0dsyW IgKMk9pCXt5AqDy; DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intuit.com; i=Charles_Honton@intuit.com; q=dns/txt; s=default; t=1307791602; x=1339327602; h=from:to:subject:date:message-id:in-reply-to:content-id: content-transfer-encoding:mime-version; z=From:=20"Honton,=20Charles"=20|To:=20Commons=20Developers=20List=20|Subject:=20Re:=20[pool]=20equal=20instances|Date: =20Sat,=2011=20Jun=202011=2011:26:08=20+0000|Message-ID: =20|In-Reply-To: =20<4DF33B70.5010000@apache.org>|Content-ID:=20 |Content-Transfer-Encoding:=20quoted-printable |MIME-Version:=201.0; bh=dyhH6Bm4fd5wIA8T+jmcmymCugSmZiAmkMaE7hAxKKs=; b=eBZ7P/4vwxxtGapxYDcUB0xfCVVl/lbWJM0o2rcAWO7r83E/WO/g7ZOD jle1snyFov+QV/dT2Wh+NQhcy9k+qsg/MXO8ZT7NPbLld0dfK9CWyiFKV N4rmjfTqku4e1lA; X-SBRS: None X-IronPort-AV: E=Sophos;i="4.65,351,1304319600"; d="scan'208";a="304562910" Received: from sdgexbh03.corp.intuit.net ([172.17.135.77]) by mail2.sdg.ie.intuit.com with ESMTP; 11 Jun 2011 04:26:11 -0700 Received: from SDGEX01.corp.intuit.net ([172.17.135.223]) by SDGEXBH03.corp.intuit.net with Microsoft SMTPSVC(6.0.3790.4675); Sat, 11 Jun 2011 04:26:11 -0700 Received: from QYNPRDEXHUBAP02.corp.intuit.net (10.136.19.160) by sdgex01.corp.intuit.net (172.17.135.223) with Microsoft SMTP Server (TLS) id 8.2.255.0; Sat, 11 Jun 2011 04:26:10 -0700 Received: from QYNPRDEXMBXAP04.corp.intuit.net ([fe80::e923:67f:882c:55c2]) by QYNPRDEXHUBAP02.corp.intuit.net ([fe80::51d0:750d:b945:30f%17]) with mapi id 14.01.0270.001; Sat, 11 Jun 2011 04:26:09 -0700 From: "Honton, Charles" To: Commons Developers List Subject: Re: [pool] equal instances Thread-Topic: [pool] equal instances Thread-Index: AQHMJlboeBiR9RXrnk69gULUz4BVmpS1JJ0AgAALuQCAAE5KAIAAAoQAgAAQJYCAABVigIAAC+MAgAGitACAAD9wgIAAAXuAgACpMoCAACSIAP//1myA Date: Sat, 11 Jun 2011 11:26:08 +0000 Message-ID: In-Reply-To: <4DF33B70.5010000@apache.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.10.0.110310 x-originating-ip: [10.136.18.4] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 11 Jun 2011 11:26:11.0210 (UTC) FILETIME=[5DAA96A0:01CC282A] Please look at java.util.IdentityHashMap again. I think it does everything you're looking for except concurrent access. Given other requirements, I'm not sure a ConcurrentHashMap will buy much performance anyway. chas On 6/11/11 5:54 AM, "Mark Thomas" wrote: >On 11/06/2011 08:44, Phil Steitz wrote: >> I have looked at this some more and I think we have two choices, >> depending on how much we want to be able to do in terms of >> monitoring and instance management. The simplest solution is to >> enable only holding references to instances checked out to clients, >> but no tracking of last active times, etc. by the pool itself >> (leaving this to the pooled objects themselves, as >> AbandonedObjectPool does now). That could be done with less >> ambitious _allObjects and PoolableObject classes. Actually, >> _allObjects would go away, replaced by a List of _circulatingObjects >> (like AbandonedObjectPool trace) and PoolableObject would really >> only maintain state for idle instances or instances undergoing >> lifecycle transitions. > >The problem with a List and objects where A.equals(B) is that we'll have >to iterate through the list testing objects for equality when an object >is returned in order to remove the right object. That will be slow. (If >we want to prevent the same object being returned multiple times). > >> If we want to be able to track things like last active time (as the >> trunk code now enables), we need to be able to identify returning >> objects uniquely. That means either we impose the factory >> discernibility requirement or use system identity hashcodes. >>=20 >> I would like to keep the monitoring / management options open, so my >> vote is for the second option. I wonder, though, if it makes sense >> to keep the base implementation simple (and a little faster) and >> restrictive and provide the equals-tolerant functionality in a >> subclass or via a config option. > >I too think that the second option is the way to go using system >identity hashcodes. I'm not sure that the first option will be faster >since iterating through the List of circulating objects is likely to be >slower than generating a system identity hashcode and doing a lookup in >a Map. If testing pool2/dbcp2 shows that the system identity hashcode >makes it significantly slower than Tomcat's jdbc-pool then we can look >at this again. > >Mark > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org >For additional commands, e-mail: dev-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org