code: @Override
      public void contextDestroyed(ServletContextEvent event) {
          try {
              logger.info("{} Shutting down Eureka Server..", new Date());
              ServletContext sc = event.getServletContext();
              sc.removeAttribute(EurekaServerContext.class.getName());
  
              destroyEurekaServerContext();
              destroyEurekaEnvironment();
  
          } catch (Throwable e) {
              logger.error("Error shutting down eureka", e);
          }
          logger.info("{} Eureka Service is now shutdown...", new Date());
      }
docs: Handles Eureka cleanup, including shutting down all monitors and yielding all EIPs.
  
  @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)