Package com.nimbusds.common.servlet
Class InfinispanLauncher
java.lang.Object
com.nimbusds.common.servlet.InfinispanLauncher
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener
,EventListener
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Logs Infinispan status and network topology after startup.static class
Logs Infinispan stop. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextDestroyed
(jakarta.servlet.ServletContextEvent sce) Handler for servlet context shutdown events.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 parameterinfinispan.configurationFile
.
-
Field Details
-
INFINISPAN_CONFIG_FILE_SETTING
The name of the setting for the Infinispan configuration filename.- See Also:
-
INFINISPAN_CTX_ATTRIBUTE_NAME
The name of the servlet context attribute for the launched Infinispan cache manager.- See Also:
-
-
Constructor Details
-
InfinispanLauncher
public InfinispanLauncher()
-
-
Method Details
-
contextInitialized
Handler for servlet context startup events; configures and launches an Infinispan cache manager using the configuration file specified in the servlet context parameterinfinispan.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 interfacejakarta.servlet.ServletContextListener
- Parameters:
sce
- A servlet context event.
-
contextDestroyed
Handler for servlet context shutdown events. Stops the Infinispan cache manager.- Specified by:
contextDestroyed
in interfacejakarta.servlet.ServletContextListener
- Parameters:
sce
- A servlet context event.
-