You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2003/11/18 03:17:33 UTC

cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound CachedConnectionManager.java

jboynes     2003/11/17 18:17:33

  Modified:    modules/core/src/java/org/apache/geronimo/connector/outbound
                        CachedConnectionManager.java
  Log:
  Initialize thread locals
  
  Revision  Changes    Path
  1.3       +16 -3     incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/CachedConnectionManager.java
  
  Index: CachedConnectionManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/CachedConnectionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CachedConnectionManager.java	13 Nov 2003 22:22:30 -0000	1.2
  +++ CachedConnectionManager.java	18 Nov 2003 02:17:33 -0000	1.3
  @@ -62,6 +62,7 @@
   import java.util.Map;
   import java.util.Set;
   import java.util.Stack;
  +import java.util.HashSet;
   
   import javax.resource.ResourceException;
   
  @@ -87,9 +88,17 @@
    * */
   public class CachedConnectionManager {
   
  -    private final ThreadLocal currentResources = new ThreadLocal();
  +    private final ThreadLocal currentResources = new ThreadLocal() {
  +        protected Object initialValue() {
  +            return new HashMap();
  +        }
  +    };
   
  -    private final ThreadLocal currentKeys = new ThreadLocal();
  +    private final ThreadLocal currentKeys = new ThreadLocal() {
  +        protected Object initialValue() {
  +            return new Stack();
  +        }
  +    };
   
       private final Map keyToResourcesMap = new IdentityHashMap();
   
  @@ -154,6 +163,10 @@
               ConnectionInfo ci) {
           Map resources = (Map) currentResources.get();
           Set infos = (Set) resources.get(mcci);
  +        if (infos == null) {
  +            infos = new HashSet();
  +            resources.put(mcci, infos);
  +        }
           infos.add(ci);
       }