Return-Path: Delivered-To: apmail-avalon-dev-archive@avalon.apache.org Received: (qmail 72699 invoked by uid 500); 5 Mar 2003 17:42:41 -0000 Mailing-List: contact dev-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list dev@avalon.apache.org Received: (qmail 72630 invoked from network); 5 Mar 2003 17:42:40 -0000 Received: from mail.gft.de (HELO mail.gft.com) (213.68.142.133) by daedalus.apache.org with SMTP; 5 Mar 2003 17:42:40 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C2E33E.9F6EAD6F" Subject: Patch AbstractContainer of Fortress Date: Wed, 5 Mar 2003 18:42:42 +0100 Message-ID: X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: Patch AbstractContainer of Fortress Thread-Index: AcLjPp8yKcKDUsIjTAmHFoT+7sK57A== From: =?iso-8859-1?Q?=22Schaible=2C_J=F6rg=22?= To: "Avalon Developers List (E-Mail)" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C2E33E.9F6EAD6F Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am currently working for some kind of dynamic created services. All these services will be children for a container, but I do not know how much there will be. The problem with the AbstractContainer is that it creates a StaticBucketMap with a fixed size of 255=20 (default) buckets for the hint map. Even more, the has table itself should never be filled to that level at all. So I would like to select my own Map used for the implementation. My patch refactores this out into a protected createHintMap function and changes any unnecessary cast to StaticBucketMap into Map. Please apply. Diff attached, but also below, since we had problems=20 with attachments lately. Regards, J=F6rg Index: src/java/org/apache/avalon/fortress/impl/AbstractContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /home/cvspublic/avalon-excalibur/fortress/src/java/org/apache/avalon/fort= ress/impl/AbstractContainer.java,v retrieving revision 1.10 diff -c -u -r1.10 AbstractContainer.java --- src/java/org/apache/avalon/fortress/impl/AbstractContainer.java 25 = Feb 2003 16:28:33 -0000 1.10 +++ src/java/org/apache/avalon/fortress/impl/AbstractContainer.java 5 = Mar 2003 16:52:16 -0000 @@ -285,12 +285,12 @@ // ServiceSelector and put that in as SELECTOR_ENTRY. if( null !=3D role && null !=3D classname && null !=3D handler = ) { - Map hintMap =3D (StaticBucketMap)m_mapper.get( role ); + Map hintMap =3D (Map)m_mapper.get( role ); =20 // Initialize the hintMap if it doesn't exist yet. if( null =3D=3D hintMap ) { - hintMap =3D new StaticBucketMap(); + hintMap =3D createHintMap(); hintMap.put( DEFAULT_ENTRY, handler ); m_mapper.put( role, hintMap ); } @@ -310,6 +310,16 @@ } } =20 + /** + * Create the hint map for a role. The map may have to take care = for thread-safety. + * By default a StaticBucketMap is created, but you may change the = implementation + * or increment the number of buckets according your needs. + */ + protected Map createHintMap() + { + return new StaticBucketMap(); + } + =20 /** * Get a ComponentHandler with the default constructor for the = component class passed in. @@ -429,7 +439,7 @@ public Object get( final String role, final Object hint ) throws ServiceException { - final Map hintMap =3D (StaticBucketMap)m_mapper.get( role ); + final Map hintMap =3D (Map)m_mapper.get( role ); Object value; =20 if( null =3D=3D hintMap ) @@ -494,7 +504,7 @@ */ public boolean has( final String role, final Object hint ) { - final Map hintMap =3D (StaticBucketMap)m_mapper.get( role ); + final Map hintMap =3D (Map)m_mapper.get( role ); boolean hasComponent =3D false; =20 if( null !=3D hintMap ) @@ -627,4 +637,4 @@ { return m_serviceManager; } -} \ No newline at end of file +} ------_=_NextPart_001_01C2E33E.9F6EAD6F Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org For additional commands, e-mail: dev-help@avalon.apache.org ------_=_NextPart_001_01C2E33E.9F6EAD6F--