Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 10844 invoked from network); 12 Oct 2010 14:17:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Oct 2010 14:17:40 -0000 Received: (qmail 70790 invoked by uid 500); 12 Oct 2010 14:17:39 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 70388 invoked by uid 500); 12 Oct 2010 14:17:38 -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 70380 invoked by uid 99); 12 Oct 2010 14:17:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Oct 2010 14:17:37 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simone.tripodi@gmail.com designates 74.125.82.49 as permitted sender) Received: from [74.125.82.49] (HELO mail-ww0-f49.google.com) (74.125.82.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Oct 2010 14:17:32 +0000 Received: by wwd20 with SMTP id 20so2668588wwd.6 for ; Tue, 12 Oct 2010 07:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=6PwujbkWrMwbfDW/fir/tndBkuonnhmTMcb5n5Z/fhc=; b=sy+knUvxonsqUSwHSBypgKfS3mg/GOCBWnQlLghWcvzEFuMv0JGx1czv53Or+xN5bH 81NbWLfZ/3I5vW5P4J2ROYt4qV3dQGAPOPd4htxD6ET/F8TdSEszOHVY15w/qKWBxgUR 9kVCJV1CwmO0qjofoRhxCIe5NwlUY9IhgKrdo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=eSN7VLchJchPUJZCDu72B5ZQjExuEtgpqYPqQqdc2zhjlepCUcHh2frm+W/ov42seQ 53LGmi+S9P5M0iD/mTVN/QsRe9NxrPiXijk5EWnfqtCDtDwSSm6rgEb2O8hyc0q3+VKB WDeScJc3cS+RWU4Wj1gCiwzA9Kycr02DuuVQs= MIME-Version: 1.0 Received: by 10.216.150.166 with SMTP id z38mr5241073wej.6.1286893030741; Tue, 12 Oct 2010 07:17:10 -0700 (PDT) Received: by 10.216.36.195 with HTTP; Tue, 12 Oct 2010 07:17:10 -0700 (PDT) In-Reply-To: <4CB46CA3.6030204@apache.org> References: <4CB462A3.30803@gmail.com> <4CB46CA3.6030204@apache.org> Date: Tue, 12 Oct 2010 16:17:10 +0200 Message-ID: Subject: Re: [POOL] generics on KeyedObjectPool From: Simone Tripodi To: Commons Developers List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi James, Mark, Being honest, I've never experienced using the keyed pool to store multiple types too, I've always used different instances to store multiple types to avoid get confused, otherwise it would be very easy - at least to me - get trapped in a Tower of Babel. I agree with you on keeping the APIs simple and straightforward. Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Oct 12, 2010 at 4:11 PM, Mark Thomas wrote: > On 12/10/2010 15:03, James Carman wrote: >> Is it really realistic to think that a pool would support multiple >> object types? =C2=A0I've never really seen that in practice, but I guess= it >> could happen. =C2=A0Just seems weird to me. > > +1. I'm having a hard time coming up with a use case where those objects > wouldn't support some common interface. And if that interface is Object, > just declare a pool of type Object. > > Lets not make things more complicated than they need to be. > > Mark > >> >> >> On Tue, Oct 12, 2010 at 9:49 AM, Simone Tripodi >> wrote: >>> Hi Brent! >>> sounds reasonably good, the only worry I've on it is about the method >>> >>> =C2=A0 =C2=A0 V borrowObject(K key); >>> >>> because I don't know the type of V; speaking in therms of examples: >>> >>> =C2=A0 =C2=A0new MyKeyedObjectPoolImpl().borrowObject("one") = =3D ??? >>> >>> So the APIs have to be improved following the Jame's suggestions. >>> Have a nice day! >>> Simo >>> >>> http://people.apache.org/~simonetripodi/ >>> http://www.99soft.org/ >>> >>> >>> >>> On Tue, Oct 12, 2010 at 3:29 PM, Brent Worden = wrote: >>>> =C2=A0The javadoc on KeyedObjectPool states 'A keyed pool pools instan= ces of >>>> multiple types.' =C2=A0However, the new parametrization on KeyedObject= Pool allows >>>> for only a single instance type. >>>> >>>> To allow for pooling multiple typed instances, should the instance typ= e >>>> parameter be removed from the interface declaration and placed on the >>>> relevant method declarations? =C2=A0In other words, replace: >>>> >>>> public interface KeyedObjectPool { >>>> ... >>>> } >>>> >>>> with: >>>> >>>> public interface KeyedObjectPool { >>>> >>>> V borrowObject(K key); >>>> >>>> void invalidateObject(K key, V obj); >>>> >>>> void returnObject(K key, V obj); >>>> ... >>>> } >>>> >>>> Thoughts? >>>> >>>> Brent. >>>> >>>> >>>> --------------------------------------------------------------------- >>>> 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 >>> >>> >> >> --------------------------------------------------------------------- >> 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org