Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2053 closed enhancement (fixed)

Send out notifications when a service is stopped and started

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.10
Component: web Version:
Keywords: Cc:

Description

The service extensions can be managed from the Administrate -> Services page. It would be useful to be able to detect when a service is stopped or started.

The background is the Open Grid vs. Reggie extensions that now depend on each other (see http://baseplugins.thep.lu.se/ticket/904 and http://baseplugins.thep.lu.se/ticket/905).

The problem we have now is that if the Open Grid service is stopped/started the configuration file is reloaded but Reggie may still contain references to the old file. What we need is a way for Reggie to get notified when the Open Grid service is restarted so that Reggie also can re-load the configuration files.

Since this could be a common issue in the future the idea is to implement this in the core where we already have an event handling model for detecting when an extension is disabled/enabled.

Change History (5)

comment:1 by Nicklas Nordborg, 7 years ago

(In [7272]) References #2053: Send out notifications when a service is stopped and started

The services extension point should now send out SERVICE_STARTED and SERVICE_STOPPED events whenever a service is started or stopped.

It's easy to pick this up in event handlers. However, there is one big problem with class loading. None of the uninstallation/update procedures will give event handlers a chance to unregister themselves which means that event handlers that are registered by extensions will remain there forever unless the extension itself remove the event handler. This must be solved within the core code since it is not realistic that extensions always will think of this issue and implement in correctly.

comment:2 by Nicklas Nordborg, 7 years ago

(In [7273]) References #2053: Send out notifications when a service is stopped and started

Updated the Registry to make it possible to register event handler together with a class loader. Extensions should use this to make sure that event handlers are automatically unregistered whenever the extension is uninstalled or updated.

The automatic unregistration happens via the ExtensionsFile.resetClassLoader() method.

Added ExtensionEventFilter to make it easier to filter out events for a specific extension.

comment:3 by Nicklas Nordborg, 7 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:4 by Nicklas Nordborg, 7 years ago

Resolution: fixed
Status: assignedclosed

Seems to be working.

comment:5 by Nicklas Nordborg, 7 years ago

(In [7275]) References #2053: Send out notifications when a service is stopped and started

Re-factored the implementation so that events are sent via the ActionIterator instead of internally in the ExtensionsInvoker.

Note: See TracTickets for help on using tickets.