Changeset 223
- Timestamp:
- 2008-05-14 13:40:08 (5 years ago)
- Location:
- trunk/core/kauri-runtime/src/main/java/org/kauriproject/runtime
- Files:
-
- 2 edited
-
KauriRuntime.java (modified) (2 diffs)
-
module/build/ModuleBuilder.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/kauri-runtime/src/main/java/org/kauriproject/runtime/KauriRuntime.java
r199 r223 35 35 import org.apache.commons.logging.LogFactory; 36 36 import org.apache.commons.jci.ReloadingClassLoader; 37 import org.apache.commons.jci.monitor.FilesystemAlterationMonitor; 38 import org.apache.commons.jci.monitor.FilesystemAlterationObserver; 37 39 38 40 import java.util.*; 39 41 import java.net.MalformedURLException; 42 import java.lang.reflect.Field; 40 43 41 44 /** … … 111 114 List<ClasspathEntry> sharedClasspath = ClassLoaderConfigurer.configureClassPaths(moduleConfigs, config.getEnableArtifactSharing()); 112 115 113 // Construct the classloader116 // Construct the shared classloader 114 117 infolog.debug("Creating shared classloader"); 115 118 116 119 rootClassLoaderHandle = ClassLoaderBuilder.build(sharedClasspath, this.getClass().getClassLoader(), config.getRepository()); 117 120 rootClassLoader = rootClassLoaderHandle.getClassLoader(); 121 122 // Construct the classloaders of the various modules 123 List<ClassLoaderHandle> moduleClassLoaders = new ArrayList<ClassLoaderHandle>(); 124 for (ModuleConfig cfg : moduleConfigs) { 125 ClassLoaderHandle classLoaderHandle = cfg.getClassLoadingConfig().getClassLoader(getClassLoader()); 126 moduleClassLoaders.add(classLoaderHandle); 127 128 ClassLoader classLoader = classLoaderHandle.getClassLoader(); 129 if (classLoader instanceof ReloadingClassLoader) { 130 // modules should also listen and reload when something in the shared classloader changes 131 rootClassLoaderHandle.addReloadNotificationListener((ReloadingClassLoader)classLoader); 132 } 133 } 118 134 119 135 // Create the modules 120 136 infolog.info("Starting the modules."); 121 137 modules = new ArrayList<Module>(config.getModules().size()); 122 for (ModuleConfig moduleConfig : moduleConfigs) { 123 Module module = ModuleBuilder.build(moduleConfig, this, config.getConfigProperties()); 138 for (int i = 0; i < moduleConfigs.size(); i++) { 139 ModuleConfig moduleConfig = moduleConfigs.get(i); 140 Module module = ModuleBuilder.build(moduleConfig, moduleClassLoaders.get(i), this, config.getConfigProperties()); 124 141 modules.add(module); 125 142 modulesById.put(module.getDefinition().getId(), module); 126 if (module.getClassLoaderHandle().getClassLoader() instanceof ReloadingClassLoader) {127 // modules should also listen and reload when something in the shared classloader changes128 rootClassLoaderHandle.addReloadNotificationListener((ReloadingClassLoader)module.getClassLoaderHandle().getClassLoader());129 }130 143 } 131 144 -
trunk/core/kauri-runtime/src/main/java/org/kauriproject/runtime/module/build/ModuleBuilder.java
r205 r223 41 41 } 42 42 43 public static Module build(ModuleConfig cfg, KauriRuntime runtime, Properties springConfigProperties) throws ArtifactNotFoundException, MalformedURLException {44 return new ModuleBuilder().buildInt(cfg, runtime, springConfigProperties);43 public static Module build(ModuleConfig cfg, ClassLoaderHandle classLoaderHandle, KauriRuntime runtime, Properties springConfigProperties) throws ArtifactNotFoundException, MalformedURLException { 44 return new ModuleBuilder().buildInt(cfg, classLoaderHandle, runtime, springConfigProperties); 45 45 } 46 46 47 private Module buildInt(ModuleConfig cfg, KauriRuntime runtime, Properties springConfigProperties) throws ArtifactNotFoundException, MalformedURLException {47 private Module buildInt(ModuleConfig cfg, ClassLoaderHandle classLoaderHandle, KauriRuntime runtime, Properties springConfigProperties) throws ArtifactNotFoundException, MalformedURLException { 48 48 infolog.info("Starting module " + cfg.getId() + " - " + cfg.getLocation()); 49 49 ClassLoader previousContextClassLoader = Thread.currentThread().getContextClassLoader(); 50 50 RestserviceFacet restserviceFacet = new RestserviceFacet(runtime.getRestserviceManager()); 51 51 try { 52 ClassLoaderHandle classLoaderHandle = cfg.getClassLoadingConfig().getClassLoader(runtime.getClassLoader());53 52 ClassLoader classLoader = classLoaderHandle.getClassLoader(); 54 55 53 Thread.currentThread().setContextClassLoader(classLoader); 56 54
Note: See TracChangeset
for help on using the changeset viewer.