You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/11/23 06:13:34 UTC

svn commit: r478468 - /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java

Author: jmarino
Date: Wed Nov 22 21:13:33 2006
New Revision: 478468

URL: http://svn.apache.org/viewvc?view=rev&rev=478468
Log:
have work context use IdentityHashMap for performance

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java?view=diff&rev=478468&r1=478467&r2=478468
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java Wed Nov 22 21:13:33 2006
@@ -18,7 +18,7 @@
  */
 package org.apache.tuscany.core.component;
 
-import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.LinkedList;
 import java.util.Map;
 
@@ -42,10 +42,10 @@
 
     //A map ( associated with the current thread) of scope identifiers keyed on the event context id type.
     //The scope identifier may be a {@link ScopeIdentifier} or an opaque id
-    
+
     // [rfeng] We cannot use InheritableThreadLocal for message ids here since it's shared by parent and children 
     private ThreadLocal<Map<Object, Object>> workContext = new ThreadLocal<Map<Object, Object>>();
-    
+
     // [rfeng] Session id requires InheritableThreadLocal
     private ThreadLocal<Map<Object, Object>> inheritableContext = new InheritableThreadLocal<Map<Object, Object>>();
 
@@ -64,7 +64,7 @@
     public void setCurrentMessageId(Object messageId) {
         Map<Object, Object> map = workContext.get();
         if (map == null) {
-            map = new HashMap<Object, Object>();
+            map = new IdentityHashMap<Object, Object>();
             workContext.set(map);
         }
         map.put(MESSAGE_ID, messageId);
@@ -81,7 +81,7 @@
     public void setCurrentCorrelationId(Object correlationId) {
         Map<Object, Object> map = workContext.get();
         if (map == null) {
-            map = new HashMap<Object, Object>();
+            map = new IdentityHashMap<Object, Object>();
             workContext.set(map);
         }
         map.put(CORRELATION_ID, correlationId);
@@ -93,18 +93,18 @@
         if (map == null) {
             return null;
         }
-        return (LinkedList<Object>)map.get(CALLBACK_ROUTING_CHAIN);
+        return (LinkedList<Object>) map.get(CALLBACK_ROUTING_CHAIN);
     }
-    
+
     public void setCurrentCallbackRoutingChain(LinkedList<Object> callbackRoutingChain) {
         Map<Object, Object> map = workContext.get();
         if (map == null) {
-            map = new HashMap<Object, Object>();
+            map = new IdentityHashMap<Object, Object>();
             workContext.set(map);
         }
         map.put(CALLBACK_ROUTING_CHAIN, callbackRoutingChain);
     }
-    
+
     public CompositeComponent getRemoteComponent() {
         Map<Object, Object> map = workContext.get();
         if (map == null) {
@@ -117,7 +117,7 @@
     public void setRemoteComponent(CompositeComponent component) {
         Map<Object, Object> map = workContext.get();
         if (map == null) {
-            map = new HashMap<Object, Object>();
+            map = new IdentityHashMap<Object, Object>();
             workContext.set(map);
         }
         map.put(REMOTE_CONTEXT, component);
@@ -140,7 +140,7 @@
     public void setIdentifier(Object type, Object identifier) {
         Map<Object, Object> map = inheritableContext.get();
         if (map == null) {
-            map = new HashMap<Object, Object>();
+            map = new IdentityHashMap<Object, Object>();
             inheritableContext.set(map);
         }
         map.put(type, identifier);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org