use of io.undertow.servlet.core.InMemorySessionManagerFactory in project wildfly by wildfly.
the class UndertowDeploymentProcessor method installSessionManagerFactory.
private static ServiceName installSessionManagerFactory(CapabilityServiceSupport support, ServiceTarget target, ServiceName deploymentServiceName, String deploymentName, Module module, JBossWebMetaData metaData, ServletContainerService servletContainerService) {
Integer maxActiveSessions = metaData.getMaxActiveSessions();
if (maxActiveSessions == null && servletContainerService != null) {
maxActiveSessions = servletContainerService.getMaxSessions();
}
ServiceName name = deploymentServiceName.append("session");
if (metaData.getDistributable() != null) {
DistributableSessionManagerFactoryBuilder sessionManagerFactoryBuilder = new DistributableSessionManagerFactoryBuilderValue().getValue();
if (sessionManagerFactoryBuilder != null) {
sessionManagerFactoryBuilder.build(support, target, name, new SimpleDistributableSessionManagerConfiguration(maxActiveSessions, metaData.getReplicationConfig(), deploymentName, module)).setInitialMode(Mode.ON_DEMAND).install();
return name;
}
// Fallback to local session manager if server does not support clustering
UndertowLogger.ROOT_LOGGER.clusteringNotSupported();
}
InMemorySessionManagerFactory factory = (maxActiveSessions != null) ? new InMemorySessionManagerFactory(maxActiveSessions) : new InMemorySessionManagerFactory();
target.addService(name, new ValueService<>(new ImmediateValue<>(factory))).setInitialMode(Mode.ON_DEMAND).install();
return name;
}
Aggregations