Class InfinispanLauncher

java.lang.Object
com.nimbusds.common.servlet.InfinispanLauncher
All Implemented Interfaces:
jakarta.servlet.ServletContextListener, EventListener

public class InfinispanLauncher extends Object implements jakarta.servlet.ServletContextListener
Configures and launches an Infinispan cache manager at servlet context startup. The cache manager is stopped at servlet context shutdown (if previously launched).

The location of the Infinispan configuration file in web application (WAR) is specified as follows:

  • By a Java system property infinispan.configurationFile
  • By a servlet context init parameter infinispan.configurationFile.

    The launched Infinispan cache manager will be exported to the servlet context as an org.infinispan.manager.EmbeddedCacheManager, under a key that bears the interface name.

  • Field Details

  • Constructor Details

  • Method Details

    • contextInitialized

      public void contextInitialized(jakarta.servlet.ServletContextEvent sce)
      Handler for servlet context startup events; configures and launches an Infinispan cache manager using the configuration file specified in the servlet context parameter infinispan.configurationFile.

      The configuration file location must be relative to the web application directory, e.g. /WEB-INF/infinispan.xml.

      Exceptions are logged at ERROR level using Log4j.

      Specified by:
      contextInitialized in interface jakarta.servlet.ServletContextListener
      Parameters:
      sce - A servlet context event.
    • contextDestroyed

      public void contextDestroyed(jakarta.servlet.ServletContextEvent sce)
      Handler for servlet context shutdown events. Stops the Infinispan cache manager.
      Specified by:
      contextDestroyed in interface jakarta.servlet.ServletContextListener
      Parameters:
      sce - A servlet context event.