diff --git a/.gitignore b/.gitignore
index 334886a99..64d12b7f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ target
velocity.log
derby.log
*.iml
+dependency-reduced-pom.xml
+
diff --git a/openjpa-features/src/main/feature/feature.xml b/openjpa-features/src/main/feature/feature.xml
index 96f771f2a..4acc18825 100644
--- a/openjpa-features/src/main/feature/feature.xml
+++ b/openjpa-features/src/main/feature/feature.xml
@@ -26,7 +26,7 @@
mvn:org.apache.geronimo.specs/geronimo-el_1.0_spec/1.0.1
mvn:org.apache.commons/commons-pool2/2.6.0
mvn:org.apache.commons/commons-dbcp2/2.5.0
- mvn:commons-collections/commons-collections/3.2.2
+ mvn:commons-collections/commons-collections4/4.3
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.14.1_1
mvn:org.apache.xbean/xbean-asm6-shaded/4.9
mvn:org.apache.openjpa/openjpa/${project.version}
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
index bf6016ced..10ef1de6d 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
@@ -31,6 +31,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType;
import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
@@ -84,7 +85,7 @@ public class InformixDictionary
protected boolean useJCC = false;
// weak set of connections we've already executed lock mode sql on
private final Collection _seenConnections = Collections.synchronizedSet(
- new ReferenceHashSet(ReferenceHashSet.WEAK));
+ new ReferenceHashSet(ReferenceStrength.WEAK));
public boolean disableRetainUpdateLocksSQL=false;
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
index 9fd833cd3..6f9456ae8 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
@@ -38,7 +38,7 @@ import java.util.SortedMap;
import java.util.Stack;
import java.util.TreeMap;
-import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections4.iterators.EmptyIterator;
import org.apache.openjpa.lib.util.StringUtil;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
index 160720bd6..3561f58f1 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.event.RemoteCommitEvent;
import org.apache.openjpa.event.RemoteCommitListener;
@@ -397,7 +398,7 @@ public abstract class AbstractQueryCache
* the only reference is held by the list of expiration listeners.
*/
protected Collection newListenerCollection() {
- return new ConcurrentReferenceHashSet (ConcurrentReferenceHashSet.WEAK);
+ return new ConcurrentReferenceHashSet(ReferenceStrength.WEAK);
}
/**
@@ -493,12 +494,12 @@ public abstract class AbstractQueryCache
private void initializeMaps() {
ConcurrentReferenceHashMap statsMap =
- new ConcurrentReferenceHashMap(ReferenceMap.HARD, ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+ new ConcurrentReferenceHashMap(ReferenceStrength.HARD, ReferenceStrength.HARD, CONCURRENCY, LOAD_FACTOR);
statsMap.setMaxSize(FIXED_SIZE);
stats = statsMap;
ConcurrentReferenceHashMap aStatsMap =
- new ConcurrentReferenceHashMap(ReferenceMap.HARD, ReferenceMap.HARD, CONCURRENCY, LOAD_FACTOR);
+ new ConcurrentReferenceHashMap(ReferenceStrength.HARD, ReferenceStrength.HARD, CONCURRENCY, LOAD_FACTOR);
aStatsMap.setMaxSize(FIXED_SIZE);
astats = aStatsMap;
}
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
index a7026c541..602a942c1 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
@@ -30,7 +30,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.collections4.map.LinkedMap;
import org.apache.openjpa.datacache.AbstractQueryCache.EvictPolicy;
import org.apache.openjpa.kernel.FetchConfiguration;
import org.apache.openjpa.kernel.LockLevels;
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
index 2149441b5..c3f61a841 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.util.ReferenceMap;
import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
@@ -40,14 +41,14 @@ public class PCRegistry {
private static final Localizer _loc = Localizer.forPackage(PCRegistry.class);
// map of persistent classes to meta structures; weak so the VM can GC classes
- private static final Map,Meta> _metas = new ConcurrentReferenceHashMap(ReferenceMap.WEAK,
- ReferenceMap.HARD);
+ private static final Map,Meta> _metas = new ConcurrentReferenceHashMap(ReferenceStrength.WEAK,
+ ReferenceStrength.HARD);
// register class listeners
// Weak reference prevents OutOfMemeoryError as described in OPENJPA-2042
private static final Collection _listeners =
new ConcurrentReferenceHashSet(
- ConcurrentReferenceHashSet.WEAK);
+ ReferenceStrength.WEAK);
/**
* Register a {@link RegisterClassListener}.
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
index 4bf522ba1..6cbe14ef5 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.TreeSet;
import org.apache.openjpa.lib.util.StringUtil;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.util.ReferenceMap;
@@ -52,11 +53,11 @@ public class Reflection {
// Weak HashMap caches of getter/setter/beanProperty methods
private static Map, Map> getterMethodCache =
- new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD);
+ new ConcurrentReferenceHashMap(ReferenceStrength.WEAK, ReferenceStrength.HARD);
private static Map, Map> setterMethodCache =
- new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD);
+ new ConcurrentReferenceHashMap(ReferenceStrength.WEAK, ReferenceStrength.HARD);
private static Map, Set> beanPropertiesNameCache =
- new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD);
+ new ConcurrentReferenceHashMap(ReferenceStrength.WEAK, ReferenceStrength.HARD);
private static Method getGetterMethod(Class> cls, String prop) {
Method rtnMethod = null;
@@ -71,8 +72,8 @@ public class Reflection {
Method method) {
Map clsMap = getterMethodCache.get(cls);
if (clsMap == null) {
- clsMap = new ConcurrentReferenceHashMap(ReferenceMap.HARD,
- ReferenceMap.WEAK);
+ clsMap = new ConcurrentReferenceHashMap(ReferenceStrength.HARD,
+ ReferenceStrength.WEAK);
getterMethodCache.put(cls, clsMap);
}
clsMap.put(prop, method);
@@ -91,8 +92,8 @@ public class Reflection {
Method method) {
Map clsMap = setterMethodCache.get(cls);
if (clsMap == null) {
- clsMap = new ConcurrentReferenceHashMap(ReferenceMap.HARD,
- ReferenceMap.WEAK);
+ clsMap = new ConcurrentReferenceHashMap(ReferenceStrength.HARD,
+ ReferenceStrength.WEAK);
setterMethodCache.put(cls, clsMap);
}
clsMap.put(prop, method);
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/event/SingleJVMRemoteCommitProvider.java b/openjpa-kernel/src/main/java/org/apache/openjpa/event/SingleJVMRemoteCommitProvider.java
index b796f26cf..ac136ad55 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/event/SingleJVMRemoteCommitProvider.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/event/SingleJVMRemoteCommitProvider.java
@@ -21,6 +21,7 @@ package org.apache.openjpa.event;
import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet;
/**
@@ -37,8 +38,7 @@ import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashSet;
public class SingleJVMRemoteCommitProvider
extends AbstractRemoteCommitProvider {
- private static Set s_providers = new ConcurrentReferenceHashSet(
- ConcurrentReferenceHashSet.HARD);
+ private static Set s_providers = new ConcurrentReferenceHashSet(ReferenceStrength.HARD);
public SingleJVMRemoteCommitProvider() {
s_providers.add(this);
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
index ff6f67c83..8cc2daced 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
@@ -39,7 +39,8 @@ import javax.transaction.Synchronization;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import org.apache.commons.collections.set.MapBackedSet;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
+import org.apache.commons.collections4.set.MapBackedSet;
import org.apache.openjpa.lib.util.StringUtil;
import org.apache.openjpa.audit.Auditor;
import org.apache.openjpa.conf.BrokerValue;
@@ -489,9 +490,9 @@ public abstract class AbstractBrokerFactory
bv = (BrokerValue) _conf.getValue(BrokerValue.KEY);
if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) {
- return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() { });
+ return MapBackedSet.mapBackedSet(new ConcurrentHashMap(), new Object() { });
} else {
- return new ConcurrentReferenceHashSet(ConcurrentReferenceHashSet.WEAK);
+ return new ConcurrentReferenceHashSet(ReferenceStrength.WEAK);
}
}
@@ -829,7 +830,7 @@ public abstract class AbstractBrokerFactory
*/
private Collection getPcClassLoaders() {
if (_pcClassLoaders == null)
- _pcClassLoaders = new ConcurrentReferenceHashSet(ConcurrentReferenceHashSet.WEAK);
+ _pcClassLoaders = new ConcurrentReferenceHashSet(ReferenceStrength.WEAK);
return _pcClassLoaders;
}
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
index 2638fd52a..92a55368a 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
@@ -20,7 +20,7 @@ package org.apache.openjpa.kernel;
import java.util.Map;
-import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.collections4.map.LinkedMap;
import org.apache.openjpa.datacache.DataCache;
import org.apache.openjpa.kernel.exps.AggregateListener;
import org.apache.openjpa.kernel.exps.FilterListener;
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachManager.java
index 0f40ab38a..188eec63d 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachManager.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachManager.java
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections.map.IdentityMap;
+import java.util.IdentityHashMap;
import org.apache.openjpa.enhance.PersistenceCapable;
import org.apache.openjpa.event.CallbackModes;
import org.apache.openjpa.event.LifecycleEvent;
@@ -59,7 +59,7 @@ public class AttachManager {
private final OpCallbacks _call;
private final boolean _copyNew;
private final boolean _failFast;
- private final IdentityMap _attached = new IdentityMap();
+ private final IdentityHashMap _attached = new IdentityHashMap();
private final Collection _visitedNodes = new ArrayList();
// reusable strategies
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
index e429fce18..3a1207b86 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
@@ -44,9 +44,10 @@ import java.util.concurrent.locks.ReentrantLock;
import javax.transaction.Status;
import javax.transaction.Synchronization;
-import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.commons.collections.map.LinkedMap;
-import org.apache.commons.collections.set.MapBackedSet;
+import org.apache.commons.collections4.iterators.IteratorChain;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.commons.collections4.set.MapBackedSet;
import org.apache.openjpa.lib.util.StringUtil;
import org.apache.openjpa.conf.Compatibility;
import org.apache.openjpa.conf.OpenJPAConfiguration;
@@ -404,7 +405,7 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
private void initializeOperatingSet() {
if(_operatingDirty) {
_operatingDirty = false;
- _operating = MapBackedSet.decorate(new IdentityHashMap