Search in sources :

Example 1 with SessionManagerFactoryConfiguration

use of org.wildfly.clustering.web.session.SessionManagerFactoryConfiguration in project wildfly by wildfly.

the class DistributableSessionManagerFactoryBuilder method build.

@Override
public ServiceBuilder<SessionManagerFactory> build(CapabilityServiceSupport support, ServiceTarget target, ServiceName name, DistributableSessionManagerConfiguration config) {
    Module module = config.getModule();
    MarshallingContext context = new SimpleMarshallingContextFactory().createMarshallingContext(new SimpleMarshallingConfigurationRepository(MarshallingVersion.class, MarshallingVersion.CURRENT, module), module.getClassLoader());
    MarshalledValueFactory<MarshallingContext> factory = new SimpleMarshalledValueFactory(context);
    SessionManagerFactoryConfiguration<MarshallingContext> configuration = new SessionManagerFactoryConfiguration<MarshallingContext>() {

        @Override
        public int getMaxActiveSessions() {
            return config.getMaxActiveSessions();
        }

        @Override
        public SessionAttributePersistenceStrategy getAttributePersistenceStrategy() {
            return strategies.get(config.getGranularity());
        }

        @Override
        public String getDeploymentName() {
            return config.getDeploymentName();
        }

        @Override
        public String getCacheName() {
            return config.getCacheName();
        }

        @Override
        public MarshalledValueFactory<MarshallingContext> getMarshalledValueFactory() {
            return factory;
        }

        @Override
        public MarshallingContext getMarshallingContext() {
            return context;
        }
    };
    Builder<org.wildfly.clustering.web.session.SessionManagerFactory<Batch>> builder = this.provider.getBuilder(configuration).configure(support);
    builder.build(target).install();
    return target.addService(name, new ValueService<>(this)).addDependency(builder.getServiceName(), org.wildfly.clustering.web.session.SessionManagerFactory.class, this.factory).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : SessionManagerFactoryConfiguration(org.wildfly.clustering.web.session.SessionManagerFactoryConfiguration) SimpleMarshallingConfigurationRepository(org.wildfly.clustering.marshalling.jboss.SimpleMarshallingConfigurationRepository) SimpleMarshallingContextFactory(org.wildfly.clustering.marshalling.jboss.SimpleMarshallingContextFactory) SimpleMarshalledValueFactory(org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValueFactory) SessionManagerFactory(io.undertow.servlet.api.SessionManagerFactory) MarshallingContext(org.wildfly.clustering.marshalling.jboss.MarshallingContext) Module(org.jboss.modules.Module)

Aggregations

SessionManagerFactory (io.undertow.servlet.api.SessionManagerFactory)1 Module (org.jboss.modules.Module)1 MarshallingContext (org.wildfly.clustering.marshalling.jboss.MarshallingContext)1 SimpleMarshalledValueFactory (org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValueFactory)1 SimpleMarshallingConfigurationRepository (org.wildfly.clustering.marshalling.jboss.SimpleMarshallingConfigurationRepository)1 SimpleMarshallingContextFactory (org.wildfly.clustering.marshalling.jboss.SimpleMarshallingContextFactory)1 SessionManagerFactoryConfiguration (org.wildfly.clustering.web.session.SessionManagerFactoryConfiguration)1