Class StrongCachingModuleScriptProvider
java.lang.Object
org.mozilla.javascript.commonjs.module.provider.CachingModuleScriptProviderBase
org.mozilla.javascript.commonjs.module.provider.StrongCachingModuleScriptProvider
- All Implemented Interfaces:
Serializable
,ModuleScriptProvider
A module script provider that uses a module source provider to load modules and caches the loaded
modules. It strongly references the loaded modules, thus a module once loaded will not be
eligible for garbage collection before the module provider itself becomes eligible.
- Version:
- $Id: StrongCachingModuleScriptProvider.java,v 1.3 2011/04/07 20:26:12 hannes%helma.at Exp $
- Author:
- Attila Szegedi
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.commonjs.module.provider.CachingModuleScriptProviderBase
CachingModuleScriptProviderBase.CachedModuleScript
-
Constructor Summary
ConstructorDescriptionStrongCachingModuleScriptProvider
(ModuleSourceProvider moduleSourceProvider) Creates a new module provider with the specified module source provider. -
Method Summary
Modifier and TypeMethodDescriptiongetLoadedModule
(String moduleId) Retrieves an already loaded moduleScript stored usingCachingModuleScriptProviderBase.putLoadedModule(String, ModuleScript, Object)
.protected void
putLoadedModule
(String moduleId, ModuleScript moduleScript, Object validator) Store a loaded module script for later retrieval usingCachingModuleScriptProviderBase.getLoadedModule(String)
.Methods inherited from class org.mozilla.javascript.commonjs.module.provider.CachingModuleScriptProviderBase
getConcurrencyLevel, getModuleScript
-
Constructor Details
-
StrongCachingModuleScriptProvider
Creates a new module provider with the specified module source provider.- Parameters:
moduleSourceProvider
- provider for modules' source code
-
-
Method Details
-
getLoadedModule
Description copied from class:CachingModuleScriptProviderBase
Retrieves an already loaded moduleScript stored usingCachingModuleScriptProviderBase.putLoadedModule(String, ModuleScript, Object)
.- Specified by:
getLoadedModule
in classCachingModuleScriptProviderBase
- Parameters:
moduleId
- the ID of the module- Returns:
- a cached module script, or null if the module is not loaded.
-
putLoadedModule
Description copied from class:CachingModuleScriptProviderBase
Store a loaded module script for later retrieval usingCachingModuleScriptProviderBase.getLoadedModule(String)
.- Specified by:
putLoadedModule
in classCachingModuleScriptProviderBase
- Parameters:
moduleId
- the ID of the modulemoduleScript
- the module scriptvalidator
- the validator for the module's source text entity
-