public class EmbeddedJarLoader extends Object implements AutoCloseable
In case if we do not want jar file to be visible for classloaders we can embed it into other jar as resource. This loaded will allow us to use those jars later on and will provide facility to load classes from them.
Please note that this class should not be used as a generic class loader. Example use case: ability to ship several versions of artifact for migration purposes (lucene indexes migrator as example)
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release class loader that was used for class loading and attempt to delete all extracted jars.
|
ClassLoader |
getJarsClassLoader()
Get class loaded of embedded jar files
|
Class |
loadEmbeddedClass(String className)
Load class from embedded jar
|
public Class loadEmbeddedClass(String className) throws ClassNotFoundException, IOException
className - fully qualified class nameClassNotFoundException - in case if specified class not foundIOException - if class cannot be extractedpublic ClassLoader getJarsClassLoader() throws IOException
IOException - if exception occurred during class loader constructionpublic void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.