diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany')
2 files changed, 11 insertions, 11 deletions
diff --git a/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java b/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java index 2ccb192fdb..1c49ea4ee4 100644 --- a/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java @@ -25,8 +25,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; @@ -39,7 +39,7 @@ import org.apache.tuscany.sca.extensibility.ServiceDeclaration; */ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint { private ExtensionPointRegistry registry; - private Map<Class<?>, Object> factories = new HashMap<Class<?>, Object>(); + private Map<Class<?>, Object> factories = new ConcurrentHashMap<Class<?>, Object>(); /** * Constructs a new DefaultModelFactoryExtensionPoint. @@ -53,7 +53,7 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint { * * @param factory The factory to add */ - public synchronized void addFactory(Object factory) { + public void addFactory(Object factory) { Class<?>[] interfaces = factory.getClass().getInterfaces(); if (interfaces.length == 0) { Class<?> sc = factory.getClass().getSuperclass(); @@ -72,7 +72,7 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint { * * @param factory The factory to remove */ - public synchronized void removeFactory(Object factory) { + public void removeFactory(Object factory) { Class<?>[] interfaces = factory.getClass().getInterfaces(); if (interfaces.length == 0) { Class<?> sc = factory.getClass().getSuperclass(); @@ -103,7 +103,7 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint { * @param factoryInterface The lookup key (factory interface) * @return The factory */ - public synchronized <T> T getFactory(Class<T> factoryInterface) { + public <T> T getFactory(Class<T> factoryInterface) { Object factory = factories.get(factoryInterface); if (factory == null) { diff --git a/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java b/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java index 41e2377db5..40e4635d77 100644 --- a/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java @@ -55,11 +55,11 @@ public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint { * * @throws IllegalArgumentException if utility is null */ - public synchronized void addUtility(Object utility) { + public void addUtility(Object utility) { addUtility(null, utility); } - public synchronized void addUtility(Object key, Object utility) { + public void addUtility(Object key, Object utility) { if (utility == null) { throw new IllegalArgumentException("Cannot register null as a Service"); } @@ -90,7 +90,7 @@ public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint { * * @throws IllegalArgumentException if utilityType is null */ - public synchronized <T> T getUtility(Class<T> utilityType) { + public <T> T getUtility(Class<T> utilityType) { return getUtility(utilityType, null); } @@ -101,7 +101,7 @@ public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint { * * @throws IllegalArgumentException if utility is null */ - public synchronized void removeUtility(Object utility) { + public void removeUtility(Object utility) { if (utility == null) { throw new IllegalArgumentException("Cannot remove null as a Service"); } @@ -143,7 +143,7 @@ public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint { } } - public synchronized <T> T getUtility(Class<T> utilityType, Object key) { + public <T> T getUtility(Class<T> utilityType, Object key) { if (utilityType == null) { throw new IllegalArgumentException("Cannot lookup Service of type null"); } @@ -197,7 +197,7 @@ public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint { return !utilityType.isInterface() && Modifier.isPublic(modifiers) && !Modifier.isAbstract(modifiers); } - public synchronized void start() { + public void start() { // NOOP } |