Return-Path: Delivered-To: apmail-avalon-cvs-archive@www.apache.org Received: (qmail 60806 invoked from network); 1 Oct 2003 12:30:02 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Oct 2003 12:30:02 -0000 Received: (qmail 27587 invoked by uid 500); 1 Oct 2003 12:29:59 -0000 Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 27508 invoked by uid 500); 1 Oct 2003 12:29:58 -0000 Mailing-List: contact cvs-help@avalon.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 cvs@avalon.apache.org Received: (qmail 27494 invoked from network); 1 Oct 2003 12:29:58 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 1 Oct 2003 12:29:58 -0000 Received: (qmail 60743 invoked by uid 1152); 1 Oct 2003 12:30:00 -0000 Date: 1 Oct 2003 12:30:00 -0000 Message-ID: <20031001123000.60742.qmail@minotaur.apache.org> From: bloritsch@apache.org To: avalon-cvs@apache.org Subject: cvs commit: avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/handler PerThreadComponentHandler.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N bloritsch 2003/10/01 05:30:00 Modified: fortress/container/src/impl/org/apache/avalon/fortress/impl/handler PerThreadComponentHandler.java Log: Update the BCEL code again to avoid the erronious INVUpdate the PerThreadComponentHandler to clean up all components, not just the current thread's Revision Changes Path 1.7 +19 -3 avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/handler/PerThreadComponentHandler.java Index: PerThreadComponentHandler.java =================================================================== RCS file: /home/cvs/avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/handler/PerThreadComponentHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- PerThreadComponentHandler.java 18 Apr 2003 20:02:29 -0000 1.6 +++ PerThreadComponentHandler.java 1 Oct 2003 12:30:00 -0000 1.7 @@ -48,6 +48,12 @@ */ package org.apache.avalon.fortress.impl.handler; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + + /** * The ThreadSafeComponentHandler to make sure components are initialized * and destroyed correctly. @@ -60,12 +66,14 @@ extends AbstractComponentHandler { private ThreadLocalComponent m_instance; + private List m_instances; public void initialize() throws Exception { super.initialize(); m_instance = new ThreadLocalComponent( this ); + m_instances = Collections.synchronizedList(new LinkedList()); } /** @@ -85,8 +93,14 @@ protected void doDispose() { - disposeComponent( m_instance.get() ); + Iterator it = m_instances.iterator(); + while (it.hasNext()) + { + disposeComponent( it.next() ); + it.remove(); + } m_instance = null; + m_instances = null; } private static final class ThreadLocalComponent @@ -103,7 +117,9 @@ { try { - return m_handler.newComponent(); + Object component = m_handler.newComponent(); + m_handler.m_instances.add(component); + return component; } catch ( final Exception e ) { --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org