Seems like a fair request.  I can't think of any advantages of having
separate instances and understand the assumption that it would be the same
instance.  Unless there's a architectural reason that we can't use the same
instance (Ben?), it sounds ticket-worthy to me.

-Burke

On Wed, Dec 7, 2011 at 11:19 AM, Rowan Seymour <[email protected]>wrote:

> 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 shutdown methods.
>
> 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;
> }
> ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
> OpenMRS Developers' mailing list

_________________________________________

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