Rename ClassloaderClassResolver to ClassLoaderClassResolver
This commit is contained in:
parent
946d4be69e
commit
b6f8b5871c
@ -0,0 +1,20 @@
|
|||||||
|
package org.jboss.netty.handler.codec.serialization;
|
||||||
|
|
||||||
|
class ClassLoaderClassResolver implements ClassResolver {
|
||||||
|
|
||||||
|
private final ClassLoader classLoader;
|
||||||
|
|
||||||
|
ClassLoaderClassResolver(ClassLoader classLoader) {
|
||||||
|
this.classLoader = classLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> resolve(String className) throws ClassNotFoundException {
|
||||||
|
try {
|
||||||
|
return classLoader.loadClass(className);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
return Class.forName(className, false, classLoader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,7 +12,7 @@ public class ClassResolvers {
|
|||||||
* @return new instance of class resolver
|
* @return new instance of class resolver
|
||||||
*/
|
*/
|
||||||
public static ClassResolver cacheDisabled(ClassLoader classLoader) {
|
public static ClassResolver cacheDisabled(ClassLoader classLoader) {
|
||||||
return new ClassloaderClassResolver(defaultClassLoader(classLoader));
|
return new ClassLoaderClassResolver(defaultClassLoader(classLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +23,7 @@ public class ClassResolvers {
|
|||||||
* @return new instance of class resolver
|
* @return new instance of class resolver
|
||||||
*/
|
*/
|
||||||
public static ClassResolver weakCachingResolver(ClassLoader classLoader) {
|
public static ClassResolver weakCachingResolver(ClassLoader classLoader) {
|
||||||
return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
|
return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +34,7 @@ public class ClassResolvers {
|
|||||||
* @return new instance of class resolver
|
* @return new instance of class resolver
|
||||||
*/
|
*/
|
||||||
public static ClassResolver softCachingResolver(ClassLoader classLoader) {
|
public static ClassResolver softCachingResolver(ClassLoader classLoader) {
|
||||||
return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
|
return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ public class ClassResolvers {
|
|||||||
* @return new instance of class resolver
|
* @return new instance of class resolver
|
||||||
*/
|
*/
|
||||||
public static ClassResolver weakCachingConcurrentResolver(ClassLoader classLoader) {
|
public static ClassResolver weakCachingConcurrentResolver(ClassLoader classLoader) {
|
||||||
return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap<String, Class<?>>(new ConcurrentHashMap<String, Reference<Class<?>>>()));
|
return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap<String, Class<?>>(new ConcurrentHashMap<String, Reference<Class<?>>>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +56,7 @@ public class ClassResolvers {
|
|||||||
* @return new instance of class resolver
|
* @return new instance of class resolver
|
||||||
*/
|
*/
|
||||||
public static ClassResolver softCachingConcurrentResolver(ClassLoader classLoader) {
|
public static ClassResolver softCachingConcurrentResolver(ClassLoader classLoader) {
|
||||||
return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap<String, Class<?>>(new ConcurrentHashMap<String, Reference<Class<?>>>()));
|
return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap<String, Class<?>>(new ConcurrentHashMap<String, Reference<Class<?>>>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClassLoader defaultClassLoader(ClassLoader classLoader) {
|
static ClassLoader defaultClassLoader(ClassLoader classLoader) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.jboss.netty.handler.codec.serialization;
|
package org.jboss.netty.handler.codec.serialization;
|
||||||
|
|
||||||
class ClassloaderClassResolver implements ClassResolver {
|
class ClassLoaderClassResolver implements ClassResolver {
|
||||||
|
|
||||||
private final ClassLoader classLoader;
|
private final ClassLoader classLoader;
|
||||||
|
|
||||||
ClassloaderClassResolver(ClassLoader classLoader) {
|
ClassLoaderClassResolver(ClassLoader classLoader) {
|
||||||
this.classLoader = classLoader;
|
this.classLoader = classLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user