public final class ModuleSystem extends Object
Constructor and Description |
---|
ModuleSystem(FileSystem systemFileSystem)
Initialize module system.
|
Modifier and Type | Method and Description |
---|---|
String |
getEffectiveClasspath(Module m)
Get the effective "classpath" used by a module.
|
Events |
getEvents()
Get the event-logging handler.
|
ModuleManager |
getManager()
Get the raw module manager.
|
List<File> |
getModuleJars()
Produce a list of JAR files including all installed modules,
their extensions, and enabled locale variants of both.
|
boolean |
isShowInAutoUpdateClient(ModuleInfo mi)
Checks whether the provided module will be visible in autoupdate client.
|
void |
loadBootModules()
Load modules found in the classpath.
|
static void |
markForRestart()
Creates files that instruct the native launcher to perform restart as
soon as the Java process finishes.
|
void |
readList()
Read disk settings and determine what the known modules are.
|
void |
refresh()
Refreshes the list of modules.
|
void |
restore()
Install read modules.
|
boolean |
shutDown(Runnable midHook)
Shut down the system: ask modules to shut down.
|
Future<Boolean> |
shutDownAsync(Runnable midHook)
Initializes the shutdown, asks modules to confirm shut down, if some
of the refure, returns
false immediately. |
public ModuleSystem(FileSystem systemFileSystem) throws IOException
IOException
public ModuleManager getManager()
public Events getEvents()
public List<File> getModuleJars()
public void loadBootModules()
public final void refresh()
public void readList()
public void restore()
public boolean shutDown(Runnable midHook)
public Future<Boolean> shutDownAsync(Runnable midHook)
false
immediately. If they
agree, run midHook code and asks modules to really shut down.
Returns even OnStop
code may not have finished yet. One
can wait for the returned future till all post clean up hooks are
finished.midHook
- the code to run when the shutdown is approvedpublic String getEffectiveClasspath(Module m)
This is a somewhat stretched notion, but should give something that looks as much like a classpath as possible, i.e. a list of directories or JARs separated by the standard separator, which roughly represents what resources are visible to the module's classloader. May use special syntax to represent situations in which only certain packages are available from a particular "classpath" entry.
Disabled modules have no classpath (empty string).
Call within a mutex.
m
- the module to build a classpath forpublic boolean isShowInAutoUpdateClient(ModuleInfo mi)
true
.
Uses caches to remember the value between restarts.mi
- the module to testtrue
if the module is supposed to be visible in
autoupdate clientpublic static void markForRestart() throws UnsupportedOperationException
UnsupportedOperationException
- some environments (like WebStart)
do not support restart and may throw an exception to indicate that