Author: jgrassel
Date: Mon Nov 24 20:51:21 2014
New Revision: 1641472

URL: http://svn.apache.org/r1641472
Log:
OPENJPA-2441: Remove usage of NullSafeConcurrentHashMap. [JDK8]

Removed:
    
openjpa/branches/2.2.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/concurrent/TestConcurrentMap.java
    
openjpa/branches/2.2.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/concurrent/TestNullSafeConcurrentHashMap.java
Modified:
    
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
    
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryStatistics.java
    
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
    
openjpa/branches/2.2.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
    
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/NullSafeConcurrentHashMap.java
    
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/SizedConcurrentHashMap.java

Modified: 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
 Mon Nov 24 20:51:21 2014
@@ -40,9 +40,10 @@ import org.apache.openjpa.lib.conf.Confi
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.ReferenceMap;
 import org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager;
+import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
 import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet;
-import org.apache.openjpa.lib.util.concurrent.SizedConcurrentHashMap;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.MetaDataRepository;
 import org.apache.openjpa.util.Id;
@@ -477,11 +478,27 @@ public abstract class AbstractQueryCache
         
         private long[] astat = new long[ARRAY_SIZE];
         private long[] stat  = new long[ARRAY_SIZE];
-        private Map<T, long[]> stats  = new SizedConcurrentHashMap(FIXED_SIZE, 
LOAD_FACTOR, CONCURRENCY);
-        private Map<T, long[]> astats = new SizedConcurrentHashMap(FIXED_SIZE, 
LOAD_FACTOR, CONCURRENCY);
+        private Map<T, long[]> stats;
+        private Map<T, long[]> astats;
         private Date start = new Date();
         private Date since = start;
         
+        public Default() {
+            initializeMaps();
+        }
+        
+        private void initializeMaps() {
+            ConcurrentReferenceHashMap statsMap =
+                    new ConcurrentReferenceHashMap(ReferenceMap.HARD, 
ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+            statsMap.setMaxSize(FIXED_SIZE);
+            stats = statsMap;
+            
+            ConcurrentReferenceHashMap aStatsMap =
+                    new ConcurrentReferenceHashMap(ReferenceMap.HARD, 
ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+            aStatsMap.setMaxSize(FIXED_SIZE);
+            astats = aStatsMap;
+        }
+        
         public Set<T> keys() {
             return stats.keySet();
         }
@@ -549,8 +566,7 @@ public abstract class AbstractQueryCache
         public synchronized void clear() {
            astat = new long[ARRAY_SIZE];
            stat  = new long[ARRAY_SIZE];
-           stats = new SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, 
CONCURRENCY);
-           astats = new SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, 
CONCURRENCY);
+           initializeMaps();
            start  = new Date();
            since  = start;
         }

Modified: 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryStatistics.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryStatistics.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryStatistics.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryStatistics.java
 Mon Nov 24 20:51:21 2014
@@ -25,7 +25,8 @@ import java.util.Date;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.openjpa.lib.util.concurrent.SizedConcurrentHashMap;
+import org.apache.openjpa.lib.util.ReferenceMap;
+import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
 
 /**
  * Records query execution statistics.
@@ -46,60 +47,60 @@ public interface QueryStatistics<T> exte
      *  Gets all the identifier keys for the cached queries.
      */
     public Set<T> keys();
-       
-       /**
-        * Record that the given query has been executed. 
-        */
-       void recordExecution(T query);
+    
+    /**
+     * Record that the given query has been executed. 
+     */
+    void recordExecution(T query);
 
     /**
      * Record that the given query has been evicted. 
      */
     void recordEviction(T query);
 
-       /**
-        * Gets number of total query execution since last reset.
-        */
-       public long getExecutionCount();
-
-       /**
-        * Gets number of total query execution since start.
-        */
-       public long getTotalExecutionCount();
-
-       /**
-        * Gets number of executions for the given query since last reset.
-        */
-       public long getExecutionCount(T query);
-
-       /**
-        * Gets number of executions for the given query since start.
-        */
-       public long getTotalExecutionCount(T query);
+    /**
+     * Gets number of total query execution since last reset.
+     */
+    public long getExecutionCount();
+
+    /**
+     * Gets number of total query execution since start.
+     */
+    public long getTotalExecutionCount();
+
+    /**
+     * Gets number of executions for the given query since last reset.
+     */
+    public long getExecutionCount(T query);
+
+    /**
+     * Gets number of executions for the given query since start.
+     */
+    public long getTotalExecutionCount(T query);
 
-       /**
+    /**
      * Gets number of total query execution that are cached since last reset.
-        */
-       public long getHitCount();
+     */
+    public long getHitCount();
+
+    /**
+     * Gets number of total query execution that are cached since start.
+     */
+    public long getTotalHitCount();
+
+    /**
+     * Gets number of executions for the given query that are cached since 
+     * last reset.
+     */
+    public long getHitCount(T query);
 
-       /**
-        * Gets number of total query execution that are cached since start.
-        */
-       public long getTotalHitCount();
-
-       /**
-        * Gets number of executions for the given query that are cached since 
-        * last reset.
-        */
-       public long getHitCount(T query);
-
-       /**
-        * Gets number of executions for the given query that are cached since 
-        * start.
-        */
-       public long getTotalHitCount(T query);
+    /**
+     * Gets number of executions for the given query that are cached since 
+     * start.
+     */
+    public long getTotalHitCount(T query);
 
-        /**
+     /**
      * Gets number of total query evictions since last reset.
      */
     public long getEvictionCount();
@@ -109,145 +110,160 @@ public interface QueryStatistics<T> exte
      */
     public long getTotalEvictionCount();
 
-       /**
-        * Gets the time of last reset.
-        */
-       public Date since();
-
-       /**
-        * Gets the time of start.
-        */
-       public Date start();
-
-       /**
-        * Clears all  statistics accumulated since last reset.
-        */
-       public void reset();
-       
-       /**
-        * Clears all statistics accumulated since start.
-        */
-       public void clear();
-       
-       /**
-        * Dumps on the given output stream.
-        */
-       public void dump(PrintStream out);
-       
-       /**
-        * A default implementation.
-        * 
-        * Maintains statistics for only a fixed number of queries.
-        * Statistical counts are approximate and not exact (to keep thread 
synchorization overhead low).
-        * 
-        */
-       public static class Default<T> implements QueryStatistics<T> {
-           private static final int FIXED_SIZE = 1000;
-           private static final float LOAD_FACTOR = 0.75f;
-           private static final int CONCURRENCY = 16;
-           
-               private static final int ARRAY_SIZE = 3;
+    /**
+     * Gets the time of last reset.
+     */
+    public Date since();
+
+    /**
+     * Gets the time of start.
+     */
+    public Date start();
+
+    /**
+     * Clears all  statistics accumulated since last reset.
+     */
+    public void reset();
+    
+    /**
+     * Clears all statistics accumulated since start.
+     */
+    public void clear();
+    
+    /**
+     * Dumps on the given output stream.
+     */
+    public void dump(PrintStream out);
+    
+    /**
+     * A default implementation.
+     * 
+     * Maintains statistics for only a fixed number of queries.
+     * Statistical counts are approximate and not exact (to keep thread 
synchorization overhead low).
+     * 
+     */
+    public static class Default<T> implements QueryStatistics<T> {
+        private static final int FIXED_SIZE = 1000;
+        private static final float LOAD_FACTOR = 0.75f;
+        private static final int CONCURRENCY = 16;
+        
+        private static final int ARRAY_SIZE = 3;
         private static final int READ  = 0;
         private static final int HIT   = 1;
         private static final int EVICT = 2;
         
-               private long[] astat = new long[ARRAY_SIZE];
-               private long[] stat  = new long[ARRAY_SIZE];
-               private Map<T, long[]> stats  = new 
SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, CONCURRENCY);
-               private Map<T, long[]> astats = new 
SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, CONCURRENCY);
-               private Date start = new Date();
-               private Date since = start;
-               
-               public Set<T> keys() {
-                   return stats.keySet();
-               }
-
-               public long getExecutionCount() {
-                       return stat[READ];
-               }
-
-               public long getTotalExecutionCount() {
-                       return astat[READ];
-               }
-
-               public long getExecutionCount(T query) {
-                       return getCount(stats, query, READ);
-               }
-
-               public long getTotalExecutionCount(T query) {
-                       return getCount(astats, query, READ);
-               }
-
-               public long getHitCount() {
-                       return stat[HIT];
-               }
-
-               public long getTotalHitCount() {
-                       return astat[HIT];
-               }
-
-               public long getHitCount(T query) {
-                       return getCount(stats, query, HIT);
-               }
-
-               public long getTotalHitCount(T query) {
-                       return getCount(astats, query, HIT);
-               }
-
-               private long getCount(Map<T, long[]> target, T query, int i) {
-                       long[] row = target.get(query);
-                       return (row == null) ? 0 : row[i];
-               }
-
-               public Date since() {
-                       return since;
-               }
-
-               public Date start() {
-                       return start;
-               }
-
-               public synchronized void reset() {
-                       stat = new long[ARRAY_SIZE];
-                       stats.clear();
-                       since = new Date();
-               }
-               
-           public synchronized void clear() {
-              astat = new long[ARRAY_SIZE];
-              stat  = new long[ARRAY_SIZE];
-              stats = new SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, 
CONCURRENCY);
-              astats = new SizedConcurrentHashMap(FIXED_SIZE, LOAD_FACTOR, 
CONCURRENCY);
-              start  = new Date();
-              since  = start;
-           }
-
-
-               private void addSample(T query, int index) {
-                       stat[index]++;
-                       astat[index]++;
-                       addSample(stats, query, index);
-                       addSample(astats, query, index);
-               }
-               
-               private void addSample(Map<T, long[]> target, T query, int i) {
-                       long[] row = target.get(query);
-                       if (row == null) {
-                               row = new long[ARRAY_SIZE];
-                       }
-                       row[i]++;
-                       target.put(query, row);
-               }
-               
-               public void recordExecution(T query) {
-                   if (query == null)
-                       return;
-                   boolean cached = astats.containsKey(query);
-                       addSample(query, READ);
-                       if (cached)
-                               addSample(query, HIT);
-               }
-               
+        private long[] astat = new long[ARRAY_SIZE];
+        private long[] stat  = new long[ARRAY_SIZE];
+        private Map<T, long[]> stats;
+        private Map<T, long[]> astats;
+        private Date start = new Date();
+        private Date since = start;
+        
+        public Default() {
+            initializeMaps();
+        }
+        
+        private void initializeMaps() {
+            ConcurrentReferenceHashMap statsMap =
+                new ConcurrentReferenceHashMap(ReferenceMap.HARD, 
ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+            statsMap.setMaxSize(FIXED_SIZE);
+            stats = statsMap;
+            
+            ConcurrentReferenceHashMap aStatsMap =
+                new ConcurrentReferenceHashMap(ReferenceMap.HARD, 
ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+            aStatsMap.setMaxSize(FIXED_SIZE);
+            astats = aStatsMap;
+        }
+        
+        public Set<T> keys() {
+            return stats.keySet();
+        }
+
+        public long getExecutionCount() {
+            return stat[READ];
+        }
+
+        public long getTotalExecutionCount() {
+            return astat[READ];
+        }
+
+        public long getExecutionCount(T query) {
+            return getCount(stats, query, READ);
+        }
+
+        public long getTotalExecutionCount(T query) {
+            return getCount(astats, query, READ);
+        }
+
+        public long getHitCount() {
+            return stat[HIT];
+        }
+
+        public long getTotalHitCount() {
+            return astat[HIT];
+        }
+
+        public long getHitCount(T query) {
+            return getCount(stats, query, HIT);
+        }
+
+        public long getTotalHitCount(T query) {
+            return getCount(astats, query, HIT);
+        }
+
+        private long getCount(Map<T, long[]> target, T query, int i) {
+            long[] row = target.get(query);
+            return (row == null) ? 0 : row[i];
+        }
+
+        public Date since() {
+            return since;
+        }
+
+        public Date start() {
+            return start;
+        }
+
+        public synchronized void reset() {
+            stat = new long[ARRAY_SIZE];
+            stats.clear();
+            since = new Date();
+        }
+        
+        public synchronized void clear() {
+           astat = new long[ARRAY_SIZE];
+           stat  = new long[ARRAY_SIZE];
+           initializeMaps();
+           start  = new Date();
+           since  = start;
+        }
+
+
+        private void addSample(T query, int index) {
+            stat[index]++;
+            astat[index]++;
+            addSample(stats, query, index);
+            addSample(astats, query, index);
+        }
+        
+        private void addSample(Map<T, long[]> target, T query, int i) {
+            long[] row = target.get(query);
+            if (row == null) {
+                row = new long[ARRAY_SIZE];
+            }
+            row[i]++;
+            target.put(query, row);
+        }
+        
+        public void recordExecution(T query) {
+            if (query == null)
+                return;
+            boolean cached = astats.containsKey(query);
+            addSample(query, READ);
+            if (cached)
+                addSample(query, HIT);
+        }
+        
         public void recordEviction(T query) {
             if (query == null) {
                 return;
@@ -255,41 +271,41 @@ public interface QueryStatistics<T> exte
             addSample(query, EVICT);
         }
 
-               public void dump(PrintStream out) {
+        public void dump(PrintStream out) {
             String header = "Query Statistics starting from " + start;
-                       out.print(header);
-                       if (since == start) {
-                               out.println();
+            out.print(header);
+            if (since == start) {
+                out.println();
                 out.println("Total Query Execution: " + toString(astat)); 
-                               out.println("\tTotal \t\tQuery");
-                       } else {
-                               out.println(" last reset on " + since);
+                out.println("\tTotal \t\tQuery");
+            } else {
+                out.println(" last reset on " + since);
                 out.println("Total Query Execution since start " + 
                         toString(astat)  + " since reset " + toString(stat));
                 out.println("\tSince Start \tSince Reset \t\tQuery");
-                       }
-                       int i = 0;
-                       for (T key : stats.keySet()) {
-                               i++;
-                               long[] arow = astats.get(key);
-                               if (since == start) {
+            }
+            int i = 0;
+            for (T key : stats.keySet()) {
+                i++;
+                long[] arow = astats.get(key);
+                if (since == start) {
                     out.println(i + ". \t" + toString(arow) + " \t" + key);
-                               } else {
-                                       long[] row  = stats.get(key);
+                } else {
+                    long[] row  = stats.get(key);
                     out.println(i + ". \t" + toString(arow) + " \t"  + 
toString(row) + " \t\t" + key);
-                               }
-                       }
-               }
-               
-               long pct(long per, long cent) {
-                       if (cent <= 0)
-                               return 0;
-                       return (100*per)/cent;
-               }
-               
-               String toString(long[] row) {
+                }
+            }
+        }
+        
+        long pct(long per, long cent) {
+            if (cent <= 0)
+                return 0;
+            return (100*per)/cent;
+        }
+        
+        String toString(long[] row) {
             return row[READ] + ":" + row[HIT] + "(" + pct(row[HIT], row[READ]) 
+ "%)";
-               }
+        }
 
         public long getEvictionCount() {
             return stat[EVICT];
@@ -298,16 +314,16 @@ public interface QueryStatistics<T> exte
         public long getTotalEvictionCount() {
             return astat[EVICT];
         }
-       }
-       
-       /**
-        * A do-nothing implementation.
-        * 
-        * @author Pinaki Poddar
-        *
-        * @param <T>
-        */
-       public static class None<T> implements QueryStatistics<T> {
+    }
+    
+    /**
+     * A do-nothing implementation.
+     * 
+     * @author Pinaki Poddar
+     *
+     * @param <T>
+     */
+    public static class None<T> implements QueryStatistics<T> {
         private Date start = new Date();
         private Date since = start;
 
@@ -379,6 +395,6 @@ public interface QueryStatistics<T> exte
 
         public void recordEviction(T query) {
         }
-       }
+    }
 }
 

Modified: 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
 Mon Nov 24 20:51:21 2014
@@ -56,9 +56,9 @@ import org.apache.openjpa.lib.util.Files
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.lib.util.Options;
-import org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap;
 
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
 
 import serp.bytecode.BCClass;
 import serp.bytecode.BCField;
@@ -94,8 +94,8 @@ public class ProxyManagerImpl
         _stdMaps.put(SortedMap.class, TreeMap.class);
     }
 
-    private final Set _unproxyable = new HashSet();
-    private final Map _proxies = new NullSafeConcurrentHashMap();
+    private final Set<String> _unproxyable = new HashSet<String>();
+    private final Map<Class<?>, Proxy> _proxies = new 
ConcurrentHashMap<Class<?>, Proxy>();
     private boolean _trackChanges = true;
     private boolean _assertType = false;
     private boolean _delayedCollectionLoading = false;
@@ -450,31 +450,32 @@ public class ProxyManagerImpl
      * Return the cached factory proxy for the given bean type.
      */
     private ProxyBean getFactoryProxyBean(Object orig) {
-        final Class type = orig.getClass();
+        final Class<?> type = orig.getClass();  
         if (isUnproxyable(type))
             return null;
 
         // we don't lock here; ok if two proxies get generated for same type
         ProxyBean proxy = (ProxyBean) _proxies.get(type);
-        if (proxy == null && !_proxies.containsKey(type)) {
-            ClassLoader l = GeneratedClasses.getMostDerivedLoader(type,
-                ProxyBean.class);
-            Class pcls = loadBuildTimeProxy(type, l);
+        if (proxy == null) {
+            ClassLoader l = GeneratedClasses.getMostDerivedLoader(type, 
ProxyBean.class);
+            Class<?> pcls = loadBuildTimeProxy(type, l);
             if (pcls == null) {
                 // TODO Move this to J2DOPrivHelper? 
-                BCClass bc = AccessController
-                    .doPrivileged(new PrivilegedAction<BCClass>() {
-                        public BCClass run() {
-                            return generateProxyBeanBytecode(type, true);
-                        }
-                    });
+                BCClass bc = AccessController.doPrivileged(new 
PrivilegedAction<BCClass>() {
+                    public BCClass run() {
+                        return generateProxyBeanBytecode(type, true);
+                    }
+                });
                 if (bc != null)
                     pcls = GeneratedClasses.loadBCClass(bc, l);
             }
             if (pcls != null)
-                proxy = (ProxyBean) instantiateProxy(pcls,
-                    findCopyConstructor(type), new Object[] {orig});
-            _proxies.put(type, proxy);
+                proxy = (ProxyBean) instantiateProxy(pcls, 
findCopyConstructor(type), new Object[] { orig });
+            if (proxy == null) {
+                _unproxyable.add(type.getName());
+            } else {
+                _proxies.put(type, proxy);
+            }
         }
         return proxy;
     }

Modified: 
openjpa/branches/2.2.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
 Mon Nov 24 20:51:21 2014
@@ -797,9 +797,35 @@ public class TestProxyManager
         NonproxyableBean orig = new NonproxyableBean(1);
         populate(orig);
         assertNull(_mgr.copyCustom(orig));
+        assertNull(_mgr.copyCustom(orig));
         assertNull(_mgr.newCustomProxy(orig,true));
     }
 
+    public void testIsUnproxyable() {
+        CustomBean validBean = new CustomBean();
+        populate(validBean);
+        assertNotNull(_mgr.copyCustom(validBean));
+        assertNotNull(_mgr.newCustomProxy(validBean, true));
+        assertFalse(_mgr.isUnproxyable(CustomBean.class));
+        
+        NonproxyableBean bean1 = new NonproxyableBean(1);
+        populate(bean1);
+        
+        NonproxyableBean2 bean2 = new NonproxyableBean2();
+        populate(bean2);
+         
+        assertFalse(_mgr.isUnproxyable(NonproxyableBean.class));
+        assertNull(_mgr.copyCustom(bean1));
+        assertTrue(_mgr.isUnproxyable(NonproxyableBean.class));
+        assertNull(_mgr.newCustomProxy(bean1, true));
+        assertTrue(_mgr.isUnproxyable(NonproxyableBean.class));
+        
+        assertFalse(_mgr.isUnproxyable(NonproxyableBean2.class));
+        assertNull(_mgr.newCustomProxy(bean2, true));
+        assertTrue(_mgr.isUnproxyable(NonproxyableBean2.class));
+        assertNull(_mgr.copyCustom(bean2));
+        assertTrue(_mgr.isUnproxyable(NonproxyableBean2.class));
+    }
 
     /**
      * Assert that the given beans are exactly the same.
@@ -1031,6 +1057,13 @@ public class TestProxyManager
     }
 
     /**
+     * Used to non-proxyable custom bean handling.
+     */
+    public class NonproxyableBean2 extends CustomBean {
+        // class is not static
+    }
+    
+    /**
      * Used to test custom calendar handling.
      */
     public static class CustomCalendar

Modified: 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/NullSafeConcurrentHashMap.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/NullSafeConcurrentHashMap.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/NullSafeConcurrentHashMap.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/NullSafeConcurrentHashMap.java
 Mon Nov 24 20:51:21 2014
@@ -37,7 +37,11 @@ import org.apache.commons.collections.se
  * concurrent methods added in {@link #ConcurrentHashMap}.
  *
  * @since 1.1.0
+ * @deprecated In Java 8, java.util.ConcurrentHashMap received an overhauled 
and this extension was not updated. This
+ * class will fail to compile on Java 8. If it is compiled at a lower level 
and run on Java 8 it will not
+ * work properly. For more information: 
https://issues.apache.org/jira/browse/OPENJPA-2441
  */
+@Deprecated
 public class NullSafeConcurrentHashMap extends ConcurrentHashMap {
 
     private enum Markers {

Modified: 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/SizedConcurrentHashMap.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/SizedConcurrentHashMap.java?rev=1641472&r1=1641471&r2=1641472&view=diff
==============================================================================
--- 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/SizedConcurrentHashMap.java
 (original)
+++ 
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/concurrent/SizedConcurrentHashMap.java
 Mon Nov 24 20:51:21 2014
@@ -33,7 +33,11 @@ import org.apache.openjpa.lib.util.Sized
  * An implementation of {@link SizedMap} that uses JDK1.5 concurrency 
primitives
  *
  * @since 1.1.0
+ * @deprecated In Java 8, java.util.ConcurrentHashMap received an overhauled 
and this extension was not updated. This
+ * class will fail to compile on Java 8. If it is compiled at a lower level 
and run on Java 8 it will not
+ * work properly. For more information: 
https://issues.apache.org/jira/browse/OPENJPA-2441
  */
+@Deprecated
 public class SizedConcurrentHashMap
     extends NullSafeConcurrentHashMap
     implements SizedMap, ConcurrentMap, Serializable {


Reply via email to