use of org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory in project wildfly by wildfly.
the class InfinispanSSOManagerFactory method createSSOManager.
@Override
public <L, C extends Marshallability> SSOManager<A, D, S, L, TransactionBatch> createSSOManager(SSOManagerConfiguration<L, C> configuration) {
Cache<Key<String>, ?> cache = this.configuration.getCache();
CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
SessionsFactory<Map<D, S>, D, S> sessionsFactory = new CoarseSessionsFactory<>(this.configuration.getCache(), properties);
SSOFactory<Map.Entry<A, AtomicReference<L>>, Map<D, S>, A, D, S, L> factory = new InfinispanSSOFactory<>(this.configuration.getCache(), properties, new MarshalledValueMarshaller<>(configuration.getMarshalledValueFactory(), configuration.getMarshallingContext()), configuration.getLocalContextFactory(), sessionsFactory);
IdentifierFactory<String> idFactory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.configuration.getKeyAffinityServiceFactory());
Batcher<TransactionBatch> batcher = new InfinispanBatcher(cache);
return new InfinispanSSOManager<>(factory, idFactory, batcher);
}
use of org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory in project wildfly by wildfly.
the class InfinispanSessionManagerFactory method createSessionManager.
@Override
public <L> SessionManager<L, TransactionBatch> createSessionManager(final SessionManagerConfiguration<L> configuration) {
final Batcher<TransactionBatch> batcher = new InfinispanBatcher(this.config.getCache());
final Cache<Key<String>, ?> cache = this.config.getCache();
final CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
final IdentifierFactory<String> factory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.config.getKeyAffinityServiceFactory());
final CommandDispatcherFactory dispatcherFactory = this.config.getCommandDispatcherFactory();
final NodeFactory<Address> nodeFactory = this.config.getNodeFactory();
final int maxActiveSessions = this.config.getSessionManagerFactoryConfiguration().getMaxActiveSessions();
InfinispanSessionManagerConfiguration config = new InfinispanSessionManagerConfiguration() {
@Override
public SessionExpirationListener getExpirationListener() {
return configuration.getExpirationListener();
}
@Override
public ServletContext getServletContext() {
return configuration.getServletContext();
}
@Override
public Cache<Key<String>, ?> getCache() {
return cache;
}
@Override
public CacheProperties getProperties() {
return properties;
}
@Override
public IdentifierFactory<String> getIdentifierFactory() {
return factory;
}
@Override
public Batcher<TransactionBatch> getBatcher() {
return batcher;
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return dispatcherFactory;
}
@Override
public NodeFactory<Address> getNodeFactory() {
return nodeFactory;
}
@Override
public int getMaxActiveSessions() {
return maxActiveSessions;
}
@Override
public Recordable<ImmutableSession> getInactiveSessionRecorder() {
return configuration.getInactiveSessionRecorder();
}
};
return new InfinispanSessionManager<>(this.createSessionFactory(properties, configuration.getLocalContextFactory()), config);
}
Aggregations