Is there a reason why the instance of a module's activator used for startup
isn't the same instance as the one used for shutdown? Looking at the
getModuleActivator()
method in Module one can see that a new instance is created each time. I
only ask because I spent forever tracking down a bug where a instance
variable was being shared unsuccessfully between the startup and
shutdownmethods.

public ModuleActivator getModuleActivator() {
try {
 ModuleClassLoader classLoader = ModuleFactory.getModuleClassLoader(this);
 if (classLoader == null)
throw new ModuleException("The classloader is null", getModuleId());
 Class<?> c = classLoader.loadClass(getActivatorName());
 Object o = c.newInstance();
if (ModuleActivator.class.isAssignableFrom(o.getClass()))
 setModuleActivator((ModuleActivator) o);
 }
catch (ClassNotFoundException e) {
 throw new ModuleException("Unable to load/find moduleActivator: '" +
getActivatorName() + "'", name, e);
 }
catch (IllegalAccessException e) {
 throw new ModuleException("Unable to load/access moduleActivator: '" +
getActivatorName() + "'", name, e);
 }
catch (InstantiationException e) {
 throw new ModuleException("Unable to load/instantiate moduleActivator: '"
+ getActivatorName() + "'", name, e);
 }
 return moduleActivator;
}

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to