/** * Gracefully shut down this database, releasing any resources that were allocated at * initialization. * * @param event ServletContextEvent to process */ public void contextDestroyed(ServletContextEvent event) { log.info("Finalizing memory database plug in"); if (database != null) { try { database.close(); } catch (Exception e) { log.error("Closing memory database", e); } } context.removeAttribute(DATABASE_KEY); context.removeAttribute(PROTOCOLS_KEY); database = null; context = null; }