HHH-8759 removed java 7 dependency in OsgiClassLoader

This commit is contained in:
Brett Meyer 2013-12-02 10:19:08 -05:00
parent d430846076
commit 685e33ae0c
1 changed files with 23 additions and 25 deletions

View File

@ -62,35 +62,33 @@ public class OsgiClassLoader extends ClassLoader {
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
synchronized (getClassLoadingLock(name)) { if ( classCache.containsKey( name ) ) {
if ( classCache.containsKey( name ) ) { return classCache.get( name );
return classCache.get( name ); }
}
for ( Bundle bundle : bundles ) { for ( Bundle bundle : bundles ) {
try { try {
final Class clazz = bundle.loadClass( name ); final Class clazz = bundle.loadClass( name );
if ( clazz != null ) { if ( clazz != null ) {
classCache.put( name, clazz ); classCache.put( name, clazz );
return clazz; return clazz;
}
}
catch ( Exception ignore ) {
} }
} }
catch ( Exception ignore ) {
}
}
for ( ClassLoader classLoader : classLoaders ) { for ( ClassLoader classLoader : classLoaders ) {
try { try {
final Class clazz = classLoader.loadClass( name ); final Class clazz = classLoader.loadClass( name );
if ( clazz != null ) { if ( clazz != null ) {
classCache.put( name, clazz ); classCache.put( name, clazz );
return clazz; return clazz;
}
}
catch ( Exception ignore ) {
} }
} }
} catch ( Exception ignore ) {
}
}
throw new ClassNotFoundException( "Could not load requested class : " + name ); throw new ClassNotFoundException( "Could not load requested class : " + name );
} }