Thanks for the report. Let me check.

Regards
JB

Le jeu. 15 nov. 2018 à 11:13, Janos Csikos <[email protected]> a écrit :

> Hi,
>
> Pax ver: 7.2.3
> Karaf ver: 4.2.1
>
> Description:
> I'm going to register an event listener, a HttpSessionListener in my
> bundle. On e.g., bundle restarts the listeners are not unregistered first
> as they treated as non-stoppable elements.
> The problem is that this way the listeners are duplicated(multiplicated)
> in jetty server (adding them to a list at
> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.addEventListener(EventListener))
> .
>
> Is this the expected behavior, do I unregister them manually?
>
> Related code:
>
> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.addWebElement(WebElement)
>
> ....
> if (webElement instanceof ListenerWebElement) {
>     LOG.debug("registering a ListenerWebElement");
>     List<WebElement> stoppableElements = webElements.stream()
>         .filter(element -> !(element instanceof ListenerWebElement))
>         .filter(element -> !(element instanceof ResourceWebElement))
>         .collect(Collectors.toList());
>     stoppableElements.forEach(element -> {
>        LOG.debug("unregistering element {}", element);
>        unregisterWebElement(element);
>     });
>     LOG.debug("registering weblement:{}", webElement);
>     registerWebElement(webElement);
> ...
>
>
> And below the finally block:
>
> ...
> } finally {
>     webElements.add(webElement);
>     httpServiceLock.writeLock().unlock();
> }
> ...
>
>
> Expected behaviour:
> The listeners are not duplicated.
>
> Actual behaviour:
> The listeners added as many times we restart the bundle.
>
> Many thanks,
> Janos
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to