Uploaded image for project: 'Observation'
  1. Observation
  2. MGNLOBS-14

Leftover threads when unregistering listeners.

    XMLWordPrintable

    Details

      Description

      "Macro" problem: if you have the observation module in your Magnolia and restart the webapp a few times (without stopping the application server), you will notice that with each restart a bunch of threads are left "orphaned" by the observation module, thus wasting the thread pool.

      The root of the problem is that deeply down, the Obervation module uses the ClockDaemon class (from oswego) as handler for delayed operations. This class has a shutDown() method which unfortunately is never called, so if the thread is not catched by garbage colletion is left there forever.

      A possible solution for the problem is to add a shutdown method in the DelayedExecutor class (that would call the ClockDaemon.shutdown), and then a corresponding shutdown up to the call chain (ObservationBasedDelayedExecutor, DeferringEventListener). With this it will be possible to call that shutdown method when unregistering an event listener in ObservationUtil.unregisterChangeListener.
      If all the listener are correctly unregistered during application shutdown (which seems to be the case), there won't be leftover threads.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              dfghi Danilo Ghirardelli
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response: