private Module loadModule(final String name, final ModuleLoader loader) { try { final Module module = loader.findLoadedModuleLocal(name); if (module == null) { throw new IllegalArgumentException("Module " + name + " not found"); } return module; } catch (ModuleLoadError e) { throw new IllegalArgumentException("Error loading module " + name + ": " + e.toString()); } }
/** * Find an already-loaded module, returning {@code null} if the module isn't currently loaded. May block * while the loaded state of the module is in question (if the module is being concurrently loaded from another * thread, for example). * * @param identifier the module identifier * @return the module, or {@code null} if it wasn't found * @deprecated Use {@link #findLoadedModuleLocal(String)} instead. */ @Deprecated protected final Module findLoadedModuleLocal(ModuleIdentifier identifier) { return findLoadedModuleLocal(identifier.toString()); }
private Module loadModule(final String name, final ModuleLoader loader) { try { final Module module = loader.findLoadedModuleLocal(ModuleIdentifier.fromString(name)); if (module == null) { throw new IllegalArgumentException("Module " + name + " not found"); } return module; } catch (ModuleLoadError e) { throw new IllegalArgumentException("Error loading module " + name + ": " + e.toString()); } }
public boolean unloadModule(final String name) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(MODULE_UNLOAD_ANY_PERM); } final ModuleLoader loader = getModuleLoader(); final Module module = loader.findLoadedModuleLocal(name); if (module == null) { return false; } else { loader.unloadModuleLocal(name, module); return true; } }
public boolean unloadModule(final String name) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(MODULE_UNLOAD_ANY_PERM); } final ModuleLoader loader = getModuleLoader(); final Module module = loader.findLoadedModuleLocal(ModuleIdentifier.fromString(name)); if (module == null) { return false; } else { loader.unloadModuleLocal(module); return true; } }