@Override
	public void contextDestroyed(ServletContextEvent event) {
		if (!instanceEnabled) {
			return;
		}
		// nettoyage avant le retrait de la webapp au cas où celui-ci ne suffise pas
		SESSION_MAP_BY_ID.clear();
		SESSION_COUNT.set(0);

		// issue 665: in WildFly 10.1.0, the MonitoringFilter may never be initialized neither destroyed.
		// For this case, it is needed to stop here the JdbcWrapper initialized in contextInitialized
		JdbcWrapper.SINGLETON.stop();

		// issue 878: NPE at net.bull.javamelody.JspWrapper.createHttpRequestWrapper
		if (event.getServletContext().getClass().getName().startsWith("io.undertow")) {
			// issue 848: NPE after SpringBoot hot restart
			Parameters.initialize((ServletContext) null);
		}

		LOG.debug("JavaMelody listener destroy done");
	}
@Test
	public void testContextDestroyed() {
		final ServletContext servletContext = createNiceMock(ServletContext.class);
		final ServletContextEvent servletContextEvent = new ServletContextEvent(servletContext);
		replay(servletContext);
		sessionListener.sessionCreated(createSessionEvent());
		sessionListener.contextDestroyed(servletContextEvent);
		verify(servletContext);
		if (!SessionListener.getAllSessionsInformations().isEmpty()) {
			fail("contextDestroyed");
		}
		if (SessionListener.getSessionCount() != 0) {
			fail("contextDestroyed");
		}
	}