@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2012 the original author or authors .
* Copyright 2002 - 2014 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -17,12 +17,13 @@
@@ -17,12 +17,13 @@
package org.springframework.context.support ;
import java.lang.reflect.Method ;
import java.util.HashMap ;
import java.util.Map ;
import java.util.concurrent.ConcurrentHashMap ;
import org.springframework.core.DecoratingClassLoader ;
import org.springframework.core.OverridingClassLoader ;
import org.springframework.core.SmartClassLoader ;
import org.springframework.lang.UsesJava7 ;
import org.springframework.util.ReflectionUtils ;
/ * *
@ -36,13 +37,21 @@ import org.springframework.util.ReflectionUtils;
@@ -36,13 +37,21 @@ import org.springframework.util.ReflectionUtils;
* @see AbstractApplicationContext
* @see org . springframework . beans . factory . config . ConfigurableBeanFactory # setTempClassLoader
* /
@UsesJava7
class ContextTypeMatchClassLoader extends DecoratingClassLoader implements SmartClassLoader {
static {
if ( parallelCapableClassLoaderAvailable ) {
ClassLoader . registerAsParallelCapable ( ) ;
}
}
private static Method findLoadedClassMethod ;
static {
try {
findLoadedClassMethod = ClassLoader . class . getDeclaredMethod ( "findLoadedClass" , new Class < ? > [ ] { String . class } ) ;
findLoadedClassMethod = ClassLoader . class . getDeclaredMethod ( "findLoadedClass" , String . class ) ;
}
catch ( NoSuchMethodException ex ) {
throw new IllegalStateException ( "Invalid [java.lang.ClassLoader] class: no 'findLoadedClass' method defined!" ) ;
@ -51,7 +60,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
@@ -51,7 +60,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
/** Cache for byte array per class name */
private final Map < String , byte [ ] > bytesCache = new HashMap < String , byte [ ] > ( ) ;
private final Map < String , byte [ ] > bytesCache = new Concurrent HashMap< String , byte [ ] > ( 256 ) ;
public ContextTypeMatchClassLoader ( ClassLoader parent ) {