You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ro...@apache.org on 2019/11/21 03:48:17 UTC
[aries-cdi] 02/03: handle ISE during shutdown
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch rotty3000/eliminate-double-start
in repository https://gitbox.apache.org/repos/asf/aries-cdi.git
View the commit online:
https://github.com/apache/aries-cdi/commit/3dd498c432af5916a0836a149b731817d2a231da
commit 3dd498c432af5916a0836a149b731817d2a231da
Author: Raymond Augé <ro...@apache.org>
AuthorDate: Wed Nov 20 22:46:44 2019 -0500
handle ISE during shutdown
Signed-off-by: Raymond Augé <ro...@apache.org>
---
.../aries/cdi/extension/http/HttpExtension.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java b/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
index 2506dcb..d9ba270 100644
--- a/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
+++ b/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
@@ -14,14 +14,11 @@
package org.apache.aries.cdi.extension.http;
-import static javax.interceptor.Interceptor.Priority.LIBRARY_AFTER;
-import static org.osgi.framework.Constants.SERVICE_DESCRIPTION;
-import static org.osgi.framework.Constants.SERVICE_RANKING;
-import static org.osgi.framework.Constants.SERVICE_VENDOR;
-import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
-import static org.osgi.service.cdi.CDIConstants.CDI_CAPABILITY_NAME;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER;
+import static javax.interceptor.Interceptor.Priority.*;
+import static org.osgi.framework.Constants.*;
+import static org.osgi.namespace.extender.ExtenderNamespace.*;
+import static org.osgi.service.cdi.CDIConstants.*;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.*;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -259,7 +256,12 @@ public class HttpExtension implements Extension {
void beforeShutdown(@Observes BeforeShutdown bs) {
if (_listenerRegistration != null && !destroyed.get()) {
- _listenerRegistration.unregister();
+ try {
+ _listenerRegistration.unregister();
+ }
+ catch (IllegalStateException ise) {
+ // the service was already unregistered.
+ }
}
}