Search in sources :

Example 1 with Key

use of org.wildfly.clustering.infinispan.spi.distribution.Key in project wildfly by wildfly.

the class InfinispanSessionManager method locatePrimaryOwner.

private Node locatePrimaryOwner(String sessionId) {
    DistributionManager dist = this.cache.getAdvancedCache().getDistributionManager();
    Address address = (dist != null) ? dist.getPrimaryLocation(new Key<>(sessionId)) : null;
    return (address != null) ? this.nodeFactory.createNode(address) : this.dispatcherFactory.getGroup().getLocalNode();
}
Also used : Address(org.infinispan.remoting.transport.Address) DistributionManager(org.infinispan.distribution.DistributionManager) Key(org.wildfly.clustering.infinispan.spi.distribution.Key)

Example 2 with Key

use of org.wildfly.clustering.infinispan.spi.distribution.Key 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 3 with Key

use of org.wildfly.clustering.infinispan.spi.distribution.Key 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

Key (org.wildfly.clustering.infinispan.spi.distribution.Key)3 Address (org.infinispan.remoting.transport.Address)2 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 AffinityIdentifierFactory (org.wildfly.clustering.web.infinispan.AffinityIdentifierFactory)2 Map (java.util.Map)1 DistributionManager (org.infinispan.distribution.DistributionManager)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