Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 71544 invoked from network); 5 Jul 2002 09:59:17 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Jul 2002 09:59:17 -0000 Received: (qmail 16221 invoked by uid 97); 5 Jul 2002 09:59:39 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 16178 invoked by uid 97); 5 Jul 2002 09:59:38 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 16167 invoked by uid 97); 5 Jul 2002 09:59:37 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 5 Jul 2002 09:59:10 -0000 Message-ID: <20020705095910.59466.qmail@icarus.apache.org> From: cziegeler@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component ExcaliburComponentManager.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N cziegeler 2002/07/05 02:59:10 Modified: component/src/java/org/apache/avalon/excalibur/component ExcaliburComponentManager.java Log: Applied patch for initialization order of components Revision Changes Path 1.9 +34 -7 jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java Index: ExcaliburComponentManager.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ExcaliburComponentManager.java 18 Jun 2002 14:25:47 -0000 1.8 +++ ExcaliburComponentManager.java 5 Jul 2002 09:59:10 -0000 1.9 @@ -60,6 +60,11 @@ /** Used to map roles to ComponentHandlers. */ private final BucketMap m_componentHandlers = new BucketMap(); + /** added component handlers before initialization to maintain + * the order of initialization + */ + private final List m_newComponentHandlers = new ArrayList(); + /** RoleInfos. */ private RoleManager m_roles; @@ -144,14 +149,10 @@ { m_initialized = true; - List keys = new ArrayList( m_componentHandlers.keySet() ); - - for( int i = 0; i < keys.size(); i++ ) + for (int i = 0; i < m_newComponentHandlers.size(); i++ ) { - final Object key = keys.get( i ); final ComponentHandler handler = - (ComponentHandler)m_componentHandlers.get( key ); - + (ComponentHandler)m_newComponentHandlers.get( i ); try { handler.initialize(); @@ -164,8 +165,33 @@ "the component handler.", e ); } } + } + + List keys = new ArrayList( m_componentHandlers.keySet() ); + + for( int i = 0; i < keys.size(); i++ ) + { + final Object key = keys.get( i ); + final ComponentHandler handler = + (ComponentHandler)m_componentHandlers.get( key ); + if ( !m_newComponentHandlers.contains( handler ) ) + { + try + { + handler.initialize(); + } + catch( Exception e ) + { + if( getLogger().isErrorEnabled() ) + { + getLogger().error( "Caught an exception trying to initialize " + + "the component handler.", e ); + } + } + } } + m_newComponentHandlers.clear(); } } @@ -645,6 +671,7 @@ handler.setLogger( getLogkitLogger() ); handler.enableLogging( getLogger() ); m_componentHandlers.put( role, handler ); + m_newComponentHandlers.add( handler ); } catch( final Exception e ) { -- To unsubscribe, e-mail: For additional commands, e-mail: