cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1477282 - /cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
Date Mon, 29 Apr 2013 19:20:29 GMT
Author: dkulp
Date: Mon Apr 29 19:20:25 2013
New Revision: 1477282

URL: http://svn.apache.org/r1477282
Log:
Merged revisions 1475915 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1475915 | dkulp | 2013-04-25 15:23:33 -0400 (Thu, 25 Apr 2013) | 19 lines

  Merged revisions 1475896 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

  ........
    r1475896 | dkulp | 2013-04-25 14:44:15 -0400 (Thu, 25 Apr 2013) | 11 lines

    Merged revisions 1475893 via  git cherry-pick from
    https://svn.apache.org/repos/asf/cxf/trunk

    ........
      r1475893 | dkulp | 2013-04-25 14:40:47 -0400 (Thu, 25 Apr 2013) | 3 lines

      [CXF-4947] More updates for the JAXBContextCache and aggressive GC's
      Patch from Rex Wang applied

    ........

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java

Modified: cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java?rev=1477282&r1=1477281&r2=1477282&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
(original)
+++ cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
Mon Apr 29 19:20:25 2013
@@ -61,9 +61,14 @@ public final class JAXBContextCache {
         private final JAXBContext context;
         private final Set<Class<?>> classes;
         private final WeakReference<CachedContextAndSchemasInternal> ccas;
+        private CachedContextAndSchemas(JAXBContext context, Set<Class<?>> classes,
CachedContextAndSchemasInternal i) {
+            this.context = context;
+            this.classes = classes;
+            ccas = new WeakReference<CachedContextAndSchemasInternal>(i);
+        }
         private CachedContextAndSchemas(CachedContextAndSchemasInternal i) {
-            classes = i.getClasses();
-            context = i.getContext();
+            this.context = i.getContext();
+            this.classes = i.getClasses();
             ccas = new WeakReference<CachedContextAndSchemasInternal>(i);
         }
         public JAXBContext getContext() {
@@ -178,28 +183,28 @@ public final class JAXBContextCache {
         if (props != null) {
             map.putAll(props);
         }
-        CachedContextAndSchemasInternal cachedContextAndSchemas = null;
+        CachedContextAndSchemasInternal cachedContextAndSchemasInternal = null;
         JAXBContext context = null;
         if (typeRefs == null || typeRefs.isEmpty()) {
             synchronized (JAXBCONTEXT_CACHE) {
                 if (exact) {
-                    cachedContextAndSchemas = JAXBCONTEXT_CACHE.get(classes);
+                    cachedContextAndSchemasInternal = JAXBCONTEXT_CACHE.get(classes);
                 } else {
                     for (Map.Entry<Set<Class<?>>, CachedContextAndSchemasInternal>
k : JAXBCONTEXT_CACHE.entrySet()) {
                         Set<Class<?>> key = k.getKey();
                         if (key != null && key.containsAll(classes)) {
-                            cachedContextAndSchemas = k.getValue();
+                            cachedContextAndSchemasInternal = k.getValue();
                             break;
                         }
                     }
                 }
-                if (cachedContextAndSchemas != null) {
-                    context = cachedContextAndSchemas.getContext();
+                if (cachedContextAndSchemasInternal != null) {
+                    context = cachedContextAndSchemasInternal.getContext();
                     if (context == null) {
-                        JAXBCONTEXT_CACHE.remove(cachedContextAndSchemas.getClasses());
-                        cachedContextAndSchemas = null;
+                        JAXBCONTEXT_CACHE.remove(cachedContextAndSchemasInternal.getClasses());
+                        cachedContextAndSchemasInternal = null;
                     } else {
-                        return new CachedContextAndSchemas(cachedContextAndSchemas);
+                        return new CachedContextAndSchemas(cachedContextAndSchemasInternal);
                     }
                 }
             }
@@ -227,14 +232,14 @@ public final class JAXBContextCache {
                 }
             }
         }
-        cachedContextAndSchemas = new CachedContextAndSchemasInternal(context, classes);
+        cachedContextAndSchemasInternal = new CachedContextAndSchemasInternal(context, classes);
         synchronized (JAXBCONTEXT_CACHE) {
             if (typeRefs == null || typeRefs.isEmpty()) {
-                JAXBCONTEXT_CACHE.put(classes, cachedContextAndSchemas);
+                JAXBCONTEXT_CACHE.put(classes, cachedContextAndSchemasInternal);
             }
         }
 
-        return new CachedContextAndSchemas(cachedContextAndSchemas);
+        return new CachedContextAndSchemas(context, classes, cachedContextAndSchemasInternal);
     }
     
     private static boolean checkObjectFactoryNamespaces(Class<?> clz) {



Mime
View raw message