Rename ClassloaderClassResolver to ClassLoaderClassResolver

This commit is contained in:
Trustin Lee 2011-11-24 10:15:51 +09:00
parent 946d4be69e
commit b6f8b5871c
3 changed files with 27 additions and 7 deletions

View File

@ -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);
}
}
}

View File

@ -12,7 +12,7 @@ public class ClassResolvers {
* @return new instance of class resolver
*/
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
*/
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
*/
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
*/
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
*/
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) {

View File

@ -1,10 +1,10 @@
package org.jboss.netty.handler.codec.serialization;
class ClassloaderClassResolver implements ClassResolver {
class ClassLoaderClassResolver implements ClassResolver {
private final ClassLoader classLoader;
ClassloaderClassResolver(ClassLoader classLoader) {
ClassLoaderClassResolver(ClassLoader classLoader) {
this.classLoader = classLoader;
}