ModuleRegistry which can be used
to get the list of available modules and/or get particular module
implementation.
Modules can only satisfy their dependencies within the ModuleRegistry
instance they are registered in.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final HashMap | |
| private LifecyclePolicy | |
| private final ArrayList | |
| private final ReentrantLock | |
| private final ModuleDefinition | |
| private volatile ModuleClassLoader | |
| private WeakReference | |
| private final ModulesRegistryImpl | registry
|
| private final Map | serviceClasses
Lazily loaded provider |
| private boolean | |
| private ModuleState | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public HK2Module | addImport(ModuleDependency
new module's definition dependency)Implements com. Create and add a new module to this module's list of imports. |
| public void | |
| public void | addListener(ModuleChangeListener
the listener listener)Implements com. Add a new module change listener |
| public void | detach()
Implements com. Detach this module from its registry. |
| public void | |
| protected void | |
| public ClassLoaderFacade | Returns: the publicClassLoaderImplements com. Return the |
| public List | Returns: the list of imported modulesImplements com. Returns the list of imported modules |
| public ModuleMetadata | getMetadata()
Implements com. Gets the metadata of this module. |
| public ModuleDefinition | Returns: the module definitionImplements com. Returns the module definition for this module instance |
| public String | getName()
Implements com. Short-cut for |
| pack-priv ModuleClassLoader | Returns: the privateClassLoader instanceReturn the private class loader for this module. |
| public <T> Iterable | getProvidersClass(Class<T> serviceClass)
Implements com.
|
| public Iterable | |
| public ModulesRegistryImpl | Returns: the registry owning the moduleImplements com. Returns the registry owning this module |
| public ModuleState | Returns: the module's stateImplements com. Returns the module's state |
| public boolean | hasProvider(Class<T> serviceClass)
Implements com. Returns true if this module has any provider for the given service class. |
| public boolean | Returns: true if this module is sharable.Implements com. Returns true if this module is sharable. |
| public boolean | Returns: true is the module is stickyImplements com. Returns true if the module is sticky. |
| pack-priv List | parseInhabitants(String name, List<PopulatorPostProcessor> postProcessors)
Parses all the inhabitants descriptors of the given name in this module. |
| public void | refresh()
Implements com. Trigger manual refresh mechanism, the module will check all its URLs and generate change events if any of them has changed. |
| public void | |
| public void | removeListener(ModuleChangeListener
the listener to unregister listener)Implements com. Unregister a module change listener |
| public void | resolve()
Implements com. Ensure that this module is |
| pack-priv void | |
| public void | setSticky(boolean
true if the module should stick around sticky)Implements com. Sets the sticky flag. |
| public void | |
| public boolean | Returns: true if unloading was successfulImplements com. Forces module stop. |
| public String | Returns: a descriptive String about myselfOverrides java. Return a String representation |
| public void | uninstall()
Implements com. Removes the module from the registry backing store, the module will need be reinstalled to be loaded. |
| dependencies | back to summary |
|---|---|
| private final List<ModuleImpl> dependencies | |
| lastModifieds | back to summary |
|---|---|
| private final HashMap<String, Long> lastModifieds | |
| lifecyclePolicy | back to summary |
|---|---|
| private LifecyclePolicy lifecyclePolicy | |
| listeners | back to summary |
|---|---|
| private final ArrayList<ModuleChangeListener> listeners | |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock | |
| moduleDef | back to summary |
|---|---|
| private final ModuleDefinition moduleDef | |
| privateCL | back to summary |
|---|---|
| private volatile ModuleClassLoader privateCL | |
| publicCL | back to summary |
|---|---|
| private WeakReference<ClassLoaderFacade> publicCL | |
| registry | back to summary |
|---|---|
| private final ModulesRegistryImpl registry
| |
| serviceClasses | back to summary |
|---|---|
| private final Map<String, List<Class<T>>> serviceClasses Lazily loaded provider | |
| shared | back to summary |
|---|---|
| private boolean shared | |
| state | back to summary |
|---|---|
| private ModuleState state | |
| sticky | back to summary |
|---|---|
| private boolean sticky | |
| ModuleImpl | back to summary |
|---|---|
| pack-priv ModuleImpl(ModulesRegistryImpl registry, ModuleDefinition info) Creates a new instance of HK2Module | |
| addImport | back to summary |
|---|---|
| public HK2Module addImport(ModuleDependency dependency) Implements com. Create and add a new module to this module's list of imports.
| |
| addImport | back to summary |
|---|---|
| public void addImport(HK2Module module) Implements com. | |
| addListener | back to summary |
|---|---|
| public void addListener(ModuleChangeListener listener) Implements com. Add a new module change listener
| |
| detach | back to summary |
|---|---|
| public void detach() Implements com. Detach this module from its registry. This does not free any of the loaded resources. Only proper release of all references to the public class loader will ensure module being garbage collected. Detached modules are orphan and will be garbage collected if resources are properly disposed. | |
| dumpState | back to summary |
|---|---|
| public void dumpState(PrintStream writer) Implements com. | |
| fireChangeEvent | back to summary |
|---|---|
| protected void fireChangeEvent() fires a ModuleChange event to all listeners | |
| getClassLoader | back to summary |
|---|---|
| public ClassLoaderFacade getClassLoader() Implements com. Return the
| |
| getImports | back to summary |
|---|---|
| public List Implements com. Returns the list of imported modules | |
| getMetadata | back to summary |
|---|---|
| public ModuleMetadata getMetadata() Implements com. Gets the metadata of this module. | |
| getModuleDefinition | back to summary |
|---|---|
| public ModuleDefinition getModuleDefinition() Implements com. Returns the module definition for this module instance
| |
| getName | back to summary |
|---|---|
| public String getName() Implements com. Short-cut for | |
| getPrivateClassLoader | back to summary |
|---|---|
| pack-priv ModuleClassLoader getPrivateClassLoader() Return the private class loader for this module. This class loader will be loading all the classes which are not explicitely exported in the module definition
| |
| getProvidersClass | back to summary |
|---|---|
| public <T> Iterable Implements com.
| |
| getProvidersClass | back to summary |
|---|---|
| public Iterable Implements com. | |
| getRegistry | back to summary |
|---|---|
| public ModulesRegistryImpl getRegistry() Implements com. Returns the registry owning this module
| |
| getState | back to summary |
|---|---|
| public ModuleState getState() Implements com. Returns the module's state
| |
| hasProvider | back to summary |
|---|---|
| public boolean hasProvider(Class<T> serviceClass) Implements com. Returns true if this module has any provider for the given service class. | |
| isShared | back to summary |
|---|---|
| public boolean isShared() Implements com. Returns true if this module is sharable. A sharable module means that onlu one instance of the module classloader will be used by all users.
| |
| isSticky | back to summary |
|---|---|
| public boolean isSticky() Implements com. Returns true if the module is sticky. A sticky module cannot be stopped or unloaded. Once a sticky module is loaded or started, it will stay in the JVM until it exists.
| |
| parseInhabitants | back to summary |
|---|---|
| pack-priv List Parses all the inhabitants descriptors of the given name in this module. | |
| refresh | back to summary |
|---|---|
| public void refresh() Implements com. Trigger manual refresh mechanism, the module will check all its URLs and generate change events if any of them has changed. This will allow the owning registry to force a module upgrade at next module request. | |
| removeImport | back to summary |
|---|---|
| public void removeImport(ModuleImpl module) | |
| removeListener | back to summary |
|---|---|
| public void removeListener(ModuleChangeListener listener) Implements com. Unregister a module change listener
| |
| resolve | back to summary |
|---|---|
| public void resolve() throws ResolveError Implements com. Ensure that this module is
If the module is already resolved, this method does nothing.
Otherwise, iterate over all declared ModuleDependency instances and use the
associated
| |
| setShared | back to summary |
|---|---|
| pack-priv void setShared(boolean sharable) Sets the sharable flag. Setting the flag to false means that the moodule class loader should not be shared among module owners.
| |
| setSticky | back to summary |
|---|---|
| public void setSticky(boolean sticky) Implements com. Sets the sticky flag.
| |
| start | back to summary |
|---|---|
| public void start() throws ResolveError Implements com. Forces module startup. In most cases, the runtime will take care
of starting modules when they are first used. There could be cases where
code need to manually start a sub module. Invoking this method will
move the module to the | |
| stop | back to summary |
|---|---|
| public boolean stop() Implements com. Forces module stop. In most cases, the runtime will take care of stopping
modules when the last module user released its interest. However, in
certain cases, it may be interesting to manually stop the module.
Stopping the module means that the module is removed from the registry,
the class loader references are released (note : the class loaders will
only be released if all instances of any class loaded by them are gc'ed).
If a
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Return a String representation
| |
| uninstall | back to summary |
|---|---|
| public void uninstall() Implements com. Doc from com. Removes the module from the registry backing store, the module will need be reinstalled to be loaded. | |