You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/04/04 18:59:11 UTC

svn commit: r1464632 - /cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java

Author: dkulp
Date: Thu Apr  4 16:59:11 2013
New Revision: 1464632

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

........
  r1464629 | dkulp | 2013-04-04 12:55:24 -0400 (Thu, 04 Apr 2013) | 10 lines

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

  ........
    r1464627 | dkulp | 2013-04-04 12:50:21 -0400 (Thu, 04 Apr 2013) | 2 lines

    [CXF-4947] Minor cleanup of JAXBContextCache as per suggestion from Rex Wang(rwonly)

  ........

........

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

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java?rev=1464632&r1=1464631&r2=1464632&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java Thu Apr  4 16:59:11 2013
@@ -47,13 +47,14 @@ import org.apache.cxf.common.util.String
 /**
  * 
  */
-public final class JAXBContextCache {
+public final class JAXBContextCache {  
+    
     /**
      * Return holder of the context, classes, etc...
      * Do NOT hold onto these strongly as that can lock the JAXBContext and Set<Class> objects
-     * into memory.  It prefererred to grab the context and classes (if needed) from this object
+     * into memory.  It preferred to grab the context and classes (if needed) from this object
      * immediately after the call to getCachedContextAndSchemas and then discard it.  The
-     * main purpose of this class is to hold onto the context/set stongly until the caller 
+     * main purpose of this class is to hold onto the context/set strongly until the caller 
      * has a chance to copy those into a place where they can hold onto it strongly as
      * needed.
      */
@@ -88,9 +89,9 @@ public final class JAXBContextCache {
         }
         
     }
-    public static final class CachedContextAndSchemasInternal {
-        private WeakReference<JAXBContext> context;
-        private WeakReference<Set<Class<?>>> classes;
+    private static final class CachedContextAndSchemasInternal {
+        private final WeakReference<JAXBContext> context;
+        private final WeakReference<Set<Class<?>>> classes;
         private Collection<DOMSource> schemas;
 
         CachedContextAndSchemasInternal(JAXBContext context, Set<Class<?>> classes) {
@@ -104,10 +105,7 @@ public final class JAXBContextCache {
         public Set<Class<?>> getClasses() {
             return classes.get();
         }
-        public void setClasses(Set<Class<?>> cls) {
-            classes = new WeakReference<Set<Class<?>>>(cls);
-        }
-        
+
         public Collection<DOMSource> getSchemas() {
             return schemas;
         }
@@ -115,7 +113,7 @@ public final class JAXBContextCache {
         public void setSchemas(Collection<DOMSource> schemas) {
             this.schemas = schemas;
         }
-    } 
+    }   
     
     private static final Map<Set<Class<?>>, CachedContextAndSchemasInternal> JAXBCONTEXT_CACHE
         = new CacheMap<Set<Class<?>>, CachedContextAndSchemasInternal>();