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);
}
Aggregations