diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-08 21:37:54 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-08 21:37:54 +0000 |
commit | 9b64185ceb87c40028c01c38a2da81a165076e81 (patch) | |
tree | feab8052da8bf9e51f35c6269623af734a108fc8 /sca-java-2.x/trunk/modules/core/src | |
parent | fd207779a42554d576f6b4a587249446fc992bae (diff) |
Use a dummy invocation chain to avoid NPE on ConcurrentHashMap
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@907812 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src')
-rw-r--r-- | sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index d737b839ba..733880a9b3 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -200,6 +200,11 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint return bindingInvocationChain; } + /** + * A dummy invocation chain representing null as ConcurrentHashMap doesn't allow null values + */ + private static final InvocationChain NULL_CHAIN = new InvocationChainImpl(null, null, false, null); + public InvocationChain getInvocationChain(Operation operation) { InvocationChain cached = invocationChainMap.get(operation); if (cached == null) { @@ -211,9 +216,13 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint return chain; } } - invocationChainMap.put(operation, null); + // Cache it with the NULL_CHAIN to avoid NPE + invocationChainMap.put(operation, NULL_CHAIN); return null; } else { + if (cached == NULL_CHAIN) { + cached = null; + } return cached; } } |