amitjoy commented on code in PR #192:
URL: https://github.com/apache/felix-dev/pull/192#discussion_r1089029908


##########
healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/servlet/HealthCheckExecutorServlet.java:
##########
@@ -215,29 +219,24 @@ protected final void activate(final 
HealthCheckExecutorServletConfiguration conf
         for (final Map.Entry<String, HttpServlet> servlet : 
servletsToRegister.entrySet()) {
             try {
                 LOG.info("Registering HC servlet {} to path {}", 
getClass().getSimpleName(), servlet.getKey());
-                this.httpService.registerServlet(servlet.getKey(), 
servlet.getValue(), null, null);
+                registerServlet(servlet.getValue(), servlet.getKey());
             } catch (Exception e) {
                 LOG.error("Could not register health check servlet: " + e, e);
             }
         }
-        this.servletPaths = servletsToRegister.keySet().toArray(new String[0]);
     }
 
     @Deactivate
     public void deactivate() {
-        if (this.servletPaths == null) {
-            return;
-        }
-
-        for (final String servletPath : this.servletPaths) {
-            try {
-                LOG.info("Unregistering HC Servlet {} from path {}", 
getClass().getSimpleName(), servletPath);
-                this.httpService.unregister(servletPath);
-            } catch (Exception e) {
-                LOG.error("Could not unregister health check servlet: " + e, 
e);
-            }
-        }
-        this.servletPaths = null;
+        servletRegistrations.forEach(ServiceRegistration::unregister);
+    }
+    
+    private void registerServlet(Servlet servlet, String path) {

Review Comment:
   Yeah, agreed 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@felix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to