Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#2053 closed enhancement (fixed)

Send out notifications when a service is stopped and started

Reported by: nicklas Owned by: nicklas
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 Changed 3 months ago by nicklas

(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 Changed 3 months ago by nicklas

(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 Changed 3 months ago by nicklas

  • Owner changed from everyone to nicklas
  • Status changed from new to assigned

comment:4 Changed 3 months ago by nicklas

  • Resolution set to fixed
  • Status changed from assigned to closed

Seems to be working.

comment:5 Changed 3 months ago by nicklas

(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.