Search in sources :

Example 1 with AffinityIdentifierFactory

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);
}
Also used : CoarseSessionsFactory(org.wildfly.clustering.web.infinispan.sso.coarse.CoarseSessionsFactory) TransactionBatch(org.wildfly.clustering.ee.infinispan.TransactionBatch) InfinispanBatcher(org.wildfly.clustering.ee.infinispan.InfinispanBatcher) InfinispanCacheProperties(org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties) CacheProperties(org.wildfly.clustering.ee.infinispan.CacheProperties) AffinityIdentifierFactory(org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory) Map(java.util.Map) Key(org.wildfly.clustering.infinispan.spi.distribution.Key) InfinispanCacheProperties(org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties)

Example 2 with AffinityIdentifierFactory

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);
}
Also used : ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) Address(org.infinispan.remoting.transport.Address) TransactionBatch(org.wildfly.clustering.ee.infinispan.TransactionBatch) InfinispanBatcher(org.wildfly.clustering.ee.infinispan.InfinispanBatcher) InfinispanCacheProperties(org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties) CacheProperties(org.wildfly.clustering.ee.infinispan.CacheProperties) AffinityIdentifierFactory(org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory) CommandDispatcherFactory(org.wildfly.clustering.dispatcher.CommandDispatcherFactory) Key(org.wildfly.clustering.infinispan.spi.distribution.Key) InfinispanCacheProperties(org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties)

Aggregations

CacheProperties (org.wildfly.clustering.ee.infinispan.CacheProperties)2 InfinispanBatcher (org.wildfly.clustering.ee.infinispan.InfinispanBatcher)2 InfinispanCacheProperties (org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties)2 TransactionBatch (org.wildfly.clustering.ee.infinispan.TransactionBatch)2 Key (org.wildfly.clustering.infinispan.spi.distribution.Key)2 AffinityIdentifierFactory (org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory)2 Map (java.util.Map)1 Address (org.infinispan.remoting.transport.Address)1 CommandDispatcherFactory (org.wildfly.clustering.dispatcher.CommandDispatcherFactory)1 CoarseSessionsFactory (org.wildfly.clustering.web.infinispan.sso.coarse.CoarseSessionsFactory)1 ImmutableSession (org.wildfly.clustering.web.session.ImmutableSession)1