This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/karaf-cave.git
The following commit(s) were added to refs/heads/master by this push: new 318a59b Improve the stop of activators 318a59b is described below commit 318a59b308b55d6e4844ad1b7e39690b80c766d4 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Wed Mar 7 10:09:20 2018 +0100 Improve the stop of activators --- .../apache/karaf/cave/server/http/Activator.java | 20 ++++++++++++---- .../apache/karaf/cave/server/maven/Activator.java | 28 ++++++++++++++++------ .../apache/karaf/cave/server/rest/Activator.java | 19 ++++++++++++--- 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/server/http/src/main/java/org/apache/karaf/cave/server/http/Activator.java b/server/http/src/main/java/org/apache/karaf/cave/server/http/Activator.java index 3daf8a0..6ed5676 100644 --- a/server/http/src/main/java/org/apache/karaf/cave/server/http/Activator.java +++ b/server/http/src/main/java/org/apache/karaf/cave/server/http/Activator.java @@ -61,10 +61,22 @@ public class Activator extends BaseActivator implements ManagedService { protected void doStop() { super.doStop(); if (httpService != null) { - httpService.unregister(alias); - } - if (this.servlet != null) { - this.servlet.destroy(); + try { + httpService.unregister(alias); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + httpService = null; + } + } + if (servlet != null) { + try { + servlet.destroy(); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + servlet = null; + } } } } diff --git a/server/maven/src/main/java/org/apache/karaf/cave/server/maven/Activator.java b/server/maven/src/main/java/org/apache/karaf/cave/server/maven/Activator.java index 6134e3c..ecf1693 100644 --- a/server/maven/src/main/java/org/apache/karaf/cave/server/maven/Activator.java +++ b/server/maven/src/main/java/org/apache/karaf/cave/server/maven/Activator.java @@ -71,16 +71,30 @@ public class Activator extends BaseActivator implements ManagedService { protected void doStop() { super.doStop(); if (httpService != null) { - httpService.unregister(alias); - } - if (this.servlet != null) { - this.servlet.destroy(); - } + try { + httpService.unregister(alias); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + httpService = null; + } + } + if (servlet != null) { + try { + servlet.destroy(); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + servlet = null; + } + } if (resolver != null) { try { resolver.close(); - } catch (IOException e) { - // Ignore + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + resolver = null; } } } diff --git a/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Activator.java b/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Activator.java index f60d459..735391a 100644 --- a/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Activator.java +++ b/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Activator.java @@ -66,10 +66,23 @@ public class Activator extends BaseActivator implements ManagedService { @Override protected void doStop() { if (httpService != null) { - httpService.unregister(alias); + try { + httpService.unregister(alias); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + httpService = null; + } } - if (this.servlet != null) { - this.servlet.destroy(); + if (servlet != null) { + try { + servlet.destroy(); + } catch (Throwable t) { + logger.debug("Exception caught while stopping", t); + } finally { + servlet = null; + } + } super.doStop(); } -- To stop receiving notification emails like this one, please contact gno...@apache.org.