Top Description Inners Fields Constructors Methods
org.jboss.modules

public Class ModuleLoader

extends Object
Class Inheritance
Known Direct Subclasses
org.jboss.modules.ClassifyingModuleLoader, org.jboss.modules.DelegatingModuleLoader
Static Imports
java.security.AccessController.doPrivileged, org.jboss.modules.management.ObjectProperties.property

A repository for modules, from which a module may be loaded by identifier. Module loaders may additionally delegate to one or more other module loaders.
Authors
David M. Lloyd, John Bailey, Richard Opalka, Jason T. Greene

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private static interface
pack-priv static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final boolean
private final AtomicInteger
private final AtomicLong
private final ModuleFinder[]
private static final Class<?>[]
private final AtomicLong
private final AtomicLong
private static final RuntimePermission
private static final RuntimePermission
private static final RuntimePermission
private static final RuntimePermission
private static final RuntimePermission
private final ConcurrentMap<String, ModuleLoader.FutureModule>
private final ModuleLoaderMXBean
public static final ModuleFinder[]
NO_FINDERS

A constant representing zero module finders.

pack-priv static final Object
private final boolean
private final boolean
private final AtomicInteger
private static final Reaper<ModuleLoader, ObjectName>
private static volatile ModuleLoader.MBeanReg
private final AtomicInteger
private static final AtomicInteger

Constructor Summary

AccessConstructor and Description
pack-priv
ModuleLoader(boolean canRedefine, boolean skipRegister)

pack-priv
ModuleLoader(boolean canRedefine, boolean skipRegister, ModuleFinder[] finders)

protected
ModuleLoader()

Construct a new instance.

public
ModuleLoader(final ModuleFinder[]
the module finders to search, in order
finders
)

Construct a new instance.

public
ModuleLoader(final ModuleFinder
the single module finder to search (must not be null)
finder
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addClassLoadTime(final long time)

pack-priv void
addLinkTime(long amount)

private static boolean
private Module

Returns:

The defined Module
defineModule
(final ConcreteModuleSpec
The module specification to create the Module from
moduleSpec
,
final ModuleLoader.FutureModule
the future module to populate
futureModule
)

Defines a Module based on a specification.

protected final Module

Returns:

the module, or null if it wasn't found
findLoadedModuleLocal
(ModuleIdentifier
the module identifier
identifier
)

Deprecated Use findLoadedModuleLocal(String) instead.
Find an already-loaded module, returning null if the module isn't currently loaded.
protected final Module

Returns:

the module, or null if it wasn't found
findLoadedModuleLocal
(String
the module identifier
name
)

Find an already-loaded module, returning null if the module isn't currently loaded.

protected ModuleSpec

Returns:

the module specification
findModule
(final ModuleIdentifier
the module identifier
moduleIdentifier
)

Deprecated Use findModule(String) instead.
This compatibility method just calls findModule(methodIdentifier.toString()) and is usually not used; if however a legacy subclass overrides this method, then it will be called instead of findModule(String), and that method will redirect to this one.
protected ModuleSpec

Returns:

the module specification, or null if no module is found with the given identifier
findModule
(final String
the module name
name
)

Find a Module's specification in this ModuleLoader by its name.

private ModuleSpec
findModule0(final String name)

public static ModuleLoader

Returns:

the module loader or null if the class's class loader does not belong to a module loader.
forClass
(Class<?>
the class
clazz
)

Get the module loader for a class.

public static ModuleLoader

Returns:

the module loader or null if the class loader does not belong to a module loader.
forClassLoader
(ClassLoader
the class loader
classLoader
)

Get the module loader for a class loader.

protected DependencySpec[]

Returns:

the current dependency list for the module
getDependencies
(Module module)

Get the current dependency list for a module which was defined by this module loader, without any access checks.

protected final ModuleFinder[]

Returns:

the module finders
getFinders
()

Get the module finders configured for this module loader.

public String

Returns:

the description string
getModuleDescription
(final Module
the module to describe
module
)

Get a string representation of the given module, used in debug output and stack traces.

pack-priv void
pack-priv void
pack-priv void
public static void
installMBeanServer()

Install JBoss Modules MBeans.

public final Iterator<ModuleIdentifier>

Returns:

an iterator for the modules in this module finder
iterateModules
(final ModuleIdentifier
the identifier to start with, or null to iterate all modules
baseIdentifier
,
final boolean
true to find recursively nested modules, false to only find immediately nested modules
recursive
)

Deprecated Use iterateModules(String, boolean) instead.
Iterate the modules which can be located via this module loader.
public final Iterator<String>

Returns:

an iterator for the modules in this module finder
iterateModules
(final String
the identifier to start with, or null to iterate all modules; ignored if this module loader does not have a concept of nested modules
baseName
,
final boolean
true to find recursively nested modules, false to only find immediately nested modules; ignored if this module finder does not have a concept of nested modules
recursive
)

Iterate the modules which can be located via this module loader.

public final Module

Returns:

The loaded Module
loadModule
(ModuleIdentifier
The module identifier
identifier
)

Deprecated Use loadModule(String) instead.
Load a module based on an identifier.
public final Module

Returns:

The loaded Module
loadModule
(String
The module name
name
)

Load a module based on an identifier.

protected final Module

Returns:

the module
loadModuleLocal
(ModuleIdentifier
the module identifier
moduleIdentifier
)

Deprecated Use loadModuleLocal(String) instead.
Try to load a module from this module loader.
protected final Module

Returns:

the module
loadModuleLocal
(String
the module name
name
)

Try to load a module from this module loader.

protected Module

Returns:

the load result, or null if the module is not found
preloadExportedModule
(String
the module name
name
)

Preload an "exported" module based on an identifier.

protected Module

Returns:

the load result, or null if the module is not found
preloadExportedModule
(ModuleIdentifier
the module identifier
identifier
)

Deprecated Use preloadModule(String) instead.
Preload an "exported" module based on an identifier.
protected Module

Returns:

the load result, or null if the module is not found
preloadModule
(ModuleIdentifier
the module identifier (must not be null)
identifier
)

Deprecated Use preloadModule(String) instead.
This compatibility method just calls preloadModule(methodIdentifier.toString()) and is usually not used; if however a legacy subclass overrides this method, then it will be called instead of preloadModule(String), and that method will redirect to this one.
protected Module

Returns:

the load result, or null if the module is not found
preloadModule
(String
the module identifier
name
)

Preload a module based on an identifier.

protected static Module

Returns:

the delegation result
preloadModule
(String
the module name
name
,
ModuleLoader
the module loader to delegate to
moduleLoader
)

Utility method to delegate to another module loader, accessible from subclasses.

protected static Module

Returns:

the delegation result
preloadModule
(ModuleIdentifier
the module identifier
identifier
,
ModuleLoader
the module loader to delegate to
moduleLoader
)

Deprecated Use preloadModule(String, ModuleLoader) instead.
Utility method to delegate to another module loader, accessible from subclasses.
protected void
refreshResourceLoaders(Module
the module to refresh
module
)

Refreshes the paths provided by resource loaders associated with the specified Module.

private static ModuleFinder[]
protected void
setAndRefreshResourceLoaders(Module
the module to update and refresh
module
,
Collection<ResourceLoaderSpec>
the new collection of loaders the module should use
loaders
)

Replaces the resources loaders for the specified module and refreshes the internal path list that is derived from the loaders.

protected void
setAndRelinkDependencies(Module
the module to update and relink
module
,
List<DependencySpec>
the new dependency list
dependencies
)

Replaces the dependencies for the specified module and relinks against the new modules This is an advanced method that should be used carefully, since it alters a live module.

public String

Returns:

the string representation
toString
()

Overrides java.lang.Object.toString.

Get the string representation of this module loader.
protected final void
unloadModuleLocal(Module
the module to unload
module
)

Deprecated use unloadModuleLocal(String, Module) instead
Unload a module from this module loader.
protected final boolean

Returns:

true iff module was unloaded
unloadModuleLocal
(final String
the module identifier
moduleId
,
final Module
the module to unload
module
)

Unload a module from this module loader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait