private synchronized void findHealthService(final HttpServletRequest request) throws ServletException {

        if (healthService == null) {
            HttpSession session = request.getSession();
            ServletContext sc = session.getServletContext();
            BundleContext ctxt = (BundleContext) sc.getAttribute("osgi-bundlecontext");

            ServiceReference<HealthCheckService> ref = ctxt.getServiceReference(HealthCheckService.class);
            if (ref == null) {
                logger.log(Level.SEVERE, "healthcheck.CWMH0000E", "HealthCheckService");
                throw new ServletException(Tr.formatMessage(tc, "OSGI_SERVICE_ERROR", "HealthCheckService"));
            } else {
                healthService = ctxt.getService(ref);
            }
        }
    }
private synchronized void findHealthService ( final HttpServletRequest request ) throws ServletException { if ( healthService == null ) { HttpSession session = request . getSession ( ) ; ServletContext sc = session . getServletContext ( ) ; BundleContext ctxt = ( BundleContext ) sc . getAttribute ( "osgi-bundlecontext" ) ; ServiceReference < HealthCheckService > ref = ctxt . getServiceReference ( HealthCheckService . class ) ; if ( ref == null ) { logger . log ( Level . SEVERE , "healthcheck.CWMH0000E" , "HealthCheckService" ) ; throw new ServletException ( Tr . formatMessage ( tc , "OSGI_SERVICE_ERROR" , "HealthCheckService" ) ) ; } else { healthService = ctxt . getService ( ref ) ; } } }
{@inheritDoc}