Package org.jini.rio.boot
Class ServiceClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
com.gigaspaces.classloader.CustomURLClassLoader
org.jini.rio.boot.ServiceClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable,ClassAnnotation,LoggableClassLoader
The ServiceClassLoader overrides getURLs(), ensuring all classes that need to be annotated with
specific location(s) are returned appropriately
-
Constructor Summary
ConstructorsConstructorDescriptionServiceClassLoader(String name, URL[] searchPath, ClassAnnotator annotator, ClassLoader parent) Constructs a new ServiceClassLoader for the specified URLs having the given parent. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddURLs(ClasspathBuilder classpathBuilder) voidAppends the specified URLs to the list of URLs to search for classes and resources.static booleanappendIfContext(java.util.function.Supplier<ClasspathBuilder> classpathBuilderSupplier) static ServiceClassLoadervoidclose()Get the class annotations as determined by theClassAnnotatorGet theClassAnnotatorcreated at construction timegetCodeChangeClassLoader(SupportCodeChangeAnnotationContainer supportCodeChangeAnnotationContainer) static FieldgetFieldFromClass(Class<?> clazz, String fieldName) getResource(String name) getResources(String name) URL[]Get the search path of URLs for loading classes and resourcesURL[]getURLs()Get the URLs to be used for class annotations as determined by theClassAnnotatorvoidinitCodeChangeClassLoadersManager(boolean supportCodeChange, int maxClassLoaders) Class<?>protected Class<?>protected static booleanmatches(String className, Collection<String> patterns) voidsetLibPath(List<URL> urls) voidsetParentClassLoader(ClassLoader classLoader) voidsetSlashPath(URL url) Methods inherited from class com.gigaspaces.classloader.CustomURLClassLoader
findClass, findResource, getLogName, toStringMethods inherited from class java.net.URLClassLoader
addURL, definePackage, findResources, getPermissions, getResourceAsStream, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
ServiceClassLoader
public ServiceClassLoader(String name, URL[] searchPath, ClassAnnotator annotator, ClassLoader parent) Constructs a new ServiceClassLoader for the specified URLs having the given parent. The constructor takes two sets of URLs. The first set is where the class loader loads classes from, the second set is what it returns when getURLs() is called.- Parameters:
searchPath- Array of URLs to search for classesannotator- Array of URLs to use for the codebaseparent- Parent ClassLoader to delegate to
-
-
Method Details
-
byName
-
getCodeChangeClassLoadersManager
-
getClassAnnotator
Get theClassAnnotatorcreated at construction time -
getURLs
Get the URLs to be used for class annotations as determined by theClassAnnotator- Overrides:
getURLsin classURLClassLoader
-
setParentClassLoader
- Throws:
Exception
-
getSearchPath
Get the search path of URLs for loading classes and resources- Overrides:
getSearchPathin classCustomURLClassLoader- Returns:
- The array of
URL[]which corresponds to the search path for the class loader; that is, the array elements are the locations from which the class loader will load requested classes.
-
addURLs
Appends the specified URLs to the list of URLs to search for classes and resources. -
addURLs
-
setLibPath
-
setSlashPath
-
getLibPath
-
getSlashPath
-
getClassAnnotation
Get the class annotations as determined by theClassAnnotator- Specified by:
getClassAnnotationin interfaceClassAnnotation- Returns:
- the class annotation string for classes defined by this loader, or
null - See Also:
-
getResource
- Overrides:
getResourcein classCustomURLClassLoader
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
loadClass
- Overrides:
loadClassin classCustomURLClassLoader- Throws:
ClassNotFoundException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classURLClassLoader- Throws:
IOException
-
getResources
- Overrides:
getResourcesin classClassLoader- Throws:
IOException
-
matches
-
getCodeChangeClassLoader
public ClassLoader getCodeChangeClassLoader(SupportCodeChangeAnnotationContainer supportCodeChangeAnnotationContainer) -
initCodeChangeClassLoadersManager
public void initCodeChangeClassLoadersManager(boolean supportCodeChange, int maxClassLoaders) -
appendIfContext
public static boolean appendIfContext(java.util.function.Supplier<ClasspathBuilder> classpathBuilderSupplier) -
getFieldFromClass
public static Field getFieldFromClass(Class<?> clazz, String fieldName) throws NoSuchFieldException, InvocationTargetException, IllegalAccessException, NoSuchMethodException
-