[MAGNOLIA-6074] Config file watch service should shut down gracefully. Created: 16/Feb/15  Updated: 05/Mar/15  Resolved: 20/Feb/15

Status: Closed
Project: Magnolia
Component/s: configuration
Affects Version/s: None
Fix Version/s: 5.4

Type: Task Priority: Neutral
Reporter: Michael Mühlebach Assignee: Michael Mühlebach
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-4294 ioc: guice add JSR250 support Closed
relates to MAGNOLIA-4760 Add support for @PostConstruct Closed
dependency
Template:
Acceptance criteria:
Empty
Task DoR:
Empty

 Comments   
Comment by Michael Mühlebach [ 18/Feb/15 ]

The first attempt was by adding complete JSR250 support with @PreDestroy. This could be done by adding the following line to GuiceComponentProvider:

GuiceComponentProvider.java
public void destroy() {
  injector.getInstance(CloseableInjector.class).close();
}

But this did not work because of the following points working together:

  • The JCR250 lifecycle annotations work only for Singletons
  • We have a special implementation for Singletons: LazySingletons
  • Those Singletons are not in the Scope Singleton but in its own custom scope
  • If a component is a singleton or not is decided either over the annotation Singleton or the scope Singleton. So our LazySingletons are no Singletons in the view of Guice itself.
  • The Mycila JCR250 extensions depends on upon the distinction between singletons and non singletons provided by guice

There are other custom implementations like https://github.com/Netflix/governator/wiki/Lazy-Singleton which work around this.

Comment by Michael Mühlebach [ 18/Feb/15 ]

The chosen implementation is now to use the module lifecycle to start and stop the directory watcher service. As long the configuration is a module itself this should work. After a possible core split we should look at this again.

Generated at Mon Feb 12 04:11:04 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.