use of org.aion.avm.stub.IAvmResourceFactory in project aion by aionnetwork.
the class AvmResourcesVersion2 method loadAvmResourceFactory.
/**
* Uses the provided classloader to load a new instance of {@link IAvmResourceFactory} defined
* in the avm version 2 module.
*/
private static IAvmResourceFactory loadAvmResourceFactory(URLClassLoader classLoader) throws IllegalAccessException, InstantiationException, ClassNotFoundException, IOException {
Class<?> factory = classLoader.loadClass(AvmDependencyInfo.avmResourceFactoryClassNameVersion2);
IAvmResourceFactory resourceFactory = (IAvmResourceFactory) factory.newInstance();
// Verify that the resources were loaded by the correct classloader.
ClassLoader resourceClassloader = resourceFactory.verifyAndReturnClassloader();
if (resourceClassloader != classLoader) {
classLoader.close();
throw new IllegalStateException("The avm resources were loaded using the wrong classloader: " + resourceClassloader);
}
return resourceFactory;
}
Aggregations