cziegeler 2004/01/22 06:08:16
Modified: component/src/java/org/apache/avalon/excalibur/component
DefaultComponentFactory.java
ExcaliburComponentSelector.java
ExcaliburComponentManager.java
Log:
Of course HashMap is not thread safe. Grmpf. If someone has an idea for a
better implementation, please go ahead. Thanks to Lars for spotting this!
Revision Changes Path
1.3 +3 -2
avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java
Index: DefaultComponentFactory.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultComponentFactory.java 21 Jan 2004 08:34:24 -0000 1.2
+++ DefaultComponentFactory.java 22 Jan 2004 14:08:16 -0000 1.3
@@ -49,6 +49,7 @@
*/
package org.apache.avalon.excalibur.component;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -122,7 +123,7 @@
* proxies, if they are Composables. These must be seperate maps in case
* a component falls into more than one category, which they often do.
*/
- private final Map m_componentProxies = new HashMap();
+ private final Map m_componentProxies = Collections.synchronizedMap(new
HashMap());
/** Instrument Manager to register objects created by this factory with (May be
null). */
private InstrumentManager m_instrumentManager;
1.3 +4 -3
avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
Index: ExcaliburComponentSelector.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExcaliburComponentSelector.java 21 Jan 2004 08:34:24 -0000 1.2
+++ ExcaliburComponentSelector.java 22 Jan 2004 14:08:16 -0000 1.3
@@ -50,6 +50,7 @@
package org.apache.avalon.excalibur.component;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -126,11 +127,11 @@
/** Static component handlers.
*/
- private Map m_componentHandlers = new HashMap();
+ private Map m_componentHandlers = Collections.synchronizedMap(new HashMap());
/** Dynamic component handlers mapping.
*/
- private Map m_componentMapping = new HashMap();
+ private Map m_componentMapping = Collections.synchronizedMap(new HashMap());
/** Flag for if this is disposed or not.
*/
1.3 +4 -3
avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
Index: ExcaliburComponentManager.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExcaliburComponentManager.java 21 Jan 2004 08:34:24 -0000 1.2
+++ ExcaliburComponentManager.java 22 Jan 2004 14:08:16 -0000 1.3
@@ -50,6 +50,7 @@
package org.apache.avalon.excalibur.component;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -113,10 +114,10 @@
private Context m_context;
/** Static component mapping handlers. */
- private final Map m_componentMapping = new HashMap();
+ private final Map m_componentMapping = Collections.synchronizedMap(new
HashMap());
/** Used to map roles to ComponentHandlers. */
- private final Map m_componentHandlers = new HashMap();
+ private final Map m_componentHandlers = Collections.synchronizedMap(new
HashMap());
/** added component handlers before initialization to maintain
* the order of initialization
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]