Package com.nimbusds.common.servlet
Class InfinispanLauncher
- java.lang.Object
-
- com.nimbusds.common.servlet.InfinispanLauncher
-
- All Implemented Interfaces:
EventListener
,javax.servlet.ServletContextListener
public class InfinispanLauncher extends Object implements javax.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InfinispanLauncher.StartLogger
Logs Infinispan status and network topology after startup.static class
InfinispanLauncher.StopLogger
Logs Infinispan stop.
-
Field Summary
Fields Modifier and Type Field Description static String
INFINISPAN_CONFIG_FILE_SETTING
The name of the setting for the Infinispan configuration filename.static String
INFINISPAN_CTX_ATTRIBUTE_NAME
The name of the servlet context attribute for the launched Infinispan cache manager.
-
Constructor Summary
Constructors Constructor Description InfinispanLauncher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextDestroyed(javax.servlet.ServletContextEvent sce)
Handler for servlet context shutdown events.void
contextInitialized(javax.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 Detail
-
INFINISPAN_CONFIG_FILE_SETTING
public static final String INFINISPAN_CONFIG_FILE_SETTING
The name of the setting for the Infinispan configuration filename.- See Also:
- Constant Field Values
-
INFINISPAN_CTX_ATTRIBUTE_NAME
public static final String INFINISPAN_CTX_ATTRIBUTE_NAME
The name of the servlet context attribute for the launched Infinispan cache manager.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InfinispanLauncher
public InfinispanLauncher()
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.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
.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 interfacejavax.servlet.ServletContextListener
- Parameters:
sce
- A servlet context event.
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
Handler for servlet context shutdown events. Stops the Infinispan cache manager.- Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
- Parameters:
sce
- A servlet context event.
-
-