mirror of https://github.com/apache/openjpa.git
OPENJPA256 this class differs from most plugins in that the plugin type is the standard java interface Map.class (rather than an openjpa-specific interface), which means that the ClassLoader used to load the implementation will be the system class loader; this presents a problem if OpenJPA is not in the system classpath, so work around the problem by catching the IllegalArgumentException (which is what we wrap the ClassNotFoundException in) and try again, this time using this class' ClassLoader.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@562011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f61968f302
commit
97b94f6aa9
|
@ -54,7 +54,24 @@ public class QueryCompilationCacheValue
|
|||
public Object newInstance(String clsName, Class type,
|
||||
Configuration conf, boolean fatal) {
|
||||
// make sure map handles concurrency
|
||||
Map map = (Map) super.newInstance(clsName, type, conf, fatal);
|
||||
Map map;
|
||||
|
||||
try {
|
||||
map = (Map) super.newInstance(clsName, type, conf, fatal);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// OPENJPA256: this class differs from most plugins in that
|
||||
// the plugin type is the standard java interface Map.class (rather
|
||||
// than an openjpa-specific interface), which means that the
|
||||
// ClassLoader used to load the implementation will be the system
|
||||
// class loader; this presents a problem if OpenJPA is not in the
|
||||
// system classpath, so work around the problem by catching
|
||||
// the IllegalArgumentException (which is what we wrap the
|
||||
// ClassNotFoundException in) and try again, this time using
|
||||
// this class' ClassLoader.
|
||||
map = (Map) super.newInstance(clsName,
|
||||
QueryCompilationCacheValue.class, conf, fatal);
|
||||
}
|
||||
|
||||
if (map != null && !(map instanceof Hashtable)
|
||||
&& !(map instanceof CacheMap)
|
||||
&& !(map instanceof ConcurrentMap))
|
||||
|
|
Loading…
Reference in New Issue