Search in sources :

Example 1 with ImmutableSessionExpirationListener

use of org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener in project wildfly-clustering-spring-session by wildfly-clustering.

the class InfinispanSessionRepository method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    ServletContext context = this.configuration.getServletContext();
    // Deployment name = host name + context path + version
    String deploymentName = context.getVirtualServerName() + context.getContextPath();
    String resourceName = this.configuration.getConfigurationResource();
    String templateName = this.configuration.getTemplateName();
    Integer maxActiveSessions = this.configuration.getMaxActiveSessions();
    SessionAttributePersistenceStrategy strategy = this.configuration.getPersistenceStrategy();
    COUNTER.incrementAndGet();
    this.stopTasks.add(() -> {
        // Stop RxJava schedulers when no longer in use
        if (COUNTER.decrementAndGet() == 0) {
            Schedulers.shutdown();
        }
    });
    ClassLoader containerLoader = WildFlySecurityManager.getClassLoaderPrivileged(InfinispanSessionManagerFactory.class);
    URL url = context.getResource(resourceName);
    if (url == null) {
        throw new FileNotFoundException(resourceName);
    }
    ConfigurationBuilderHolder holder = new ParserRegistry().parse(url);
    GlobalConfigurationBuilder global = holder.getGlobalConfigurationBuilder();
    String containerName = global.cacheContainer().name();
    TransportConfiguration transport = global.transport().create();
    JGroupsChannelConfigurator configurator = (transport.transport() != null) ? new JChannelConfigurator(context, transport) : null;
    JChannel channel = (configurator != null) ? configurator.createChannel(null) : null;
    if (channel != null) {
        channel.setName(transport.nodeName());
        channel.setDiscardOwnMessages(true);
        channel.connect(transport.clusterName());
        this.stopTasks.add(channel::close);
        GlobalJmxConfiguration jmx = global.jmx().create();
        if (jmx.enabled()) {
            ObjectName prefix = new ObjectName(jmx.domain(), "manager", ObjectName.quote(containerName));
            JmxConfigurator.registerChannel(channel, ManagementFactory.getPlatformMBeanServer(), prefix, transport.clusterName(), true);
            this.stopTasks.add(() -> {
                try {
                    JmxConfigurator.unregisterChannel(channel, ManagementFactory.getPlatformMBeanServer(), prefix, transport.clusterName());
                } catch (Exception e) {
                    context.log(e.getLocalizedMessage(), e);
                }
            });
        }
        Properties properties = new Properties();
        properties.put(JGroupsTransport.CHANNEL_CONFIGURATOR, new ForkChannelConfigurator(channel, containerName));
        global.transport().withProperties(properties);
    }
    Function<ClassLoader, ByteBufferMarshaller> marshallerFactory = this.configuration.getMarshallerFactory();
    CommandDispatcherFactory dispatcherFactory = (channel != null) ? new ChannelCommandDispatcherFactory(new ChannelCommandDispatcherFactoryConfiguration() {

        @Override
        public JChannel getChannel() {
            return channel;
        }

        @Override
        public ByteBufferMarshaller getMarshaller() {
            return SessionMarshallerFactory.PROTOSTREAM.apply(containerLoader);
        }

        @Override
        public Duration getTimeout() {
            return Duration.ofMillis(transport.initialClusterTimeout());
        }

        @Override
        public Function<ClassLoader, ByteBufferMarshaller> getMarshallerFactory() {
            return marshallerFactory;
        }

        @Override
        public Predicate<ByteBuffer> getUnknownForkPredicate() {
            return buffer -> buffer.remaining() == 0;
        }

        @Override
        public Function<ClassLoader, Contextualizer> getContextualizerFactory() {
            return loader -> new ContextReferenceExecutor<>(loader, ContextClassLoaderReference.INSTANCE);
        }
    }) : new LocalCommandDispatcherFactory(new LocalGroup(transport.nodeName()));
    if (channel != null) {
        ChannelCommandDispatcherFactory factory = (ChannelCommandDispatcherFactory) dispatcherFactory;
        this.stopTasks.add(factory::close);
    }
    holder.getGlobalConfigurationBuilder().classLoader(containerLoader).blockingThreadPool().threadFactory(new DefaultThreadFactory(BlockingManager.class)).expirationThreadPool().threadFactory(new DefaultThreadFactory(ExpirationManager.class)).listenerThreadPool().threadFactory(new DefaultThreadFactory(ListenerInvocation.class)).nonBlockingThreadPool().threadFactory(new DefaultNonBlockingThreadFactory(NonBlockingManager.class)).serialization().marshaller(new InfinispanProtoStreamMarshaller(new SimpleClassLoaderMarshaller(containerLoader), builder -> builder.load(containerLoader))).addContextInitializer(new SerializationContextInitializer() {

        @Deprecated
        @Override
        public String getProtoFile() {
            return null;
        }

        @Deprecated
        @Override
        public String getProtoFileName() {
            return null;
        }

        @Override
        public void registerMarshallers(SerializationContext context) {
        }

        @Override
        public void registerSchema(SerializationContext context) {
        }
    }).globalState().configurationStorage(ConfigurationStorage.IMMUTABLE).disable();
    @SuppressWarnings("resource") EmbeddedCacheManager container = new DefaultCacheManager(holder, false);
    Configuration template = (templateName != null) ? container.getCacheConfiguration(templateName) : container.getDefaultCacheConfiguration();
    if (template == null) {
        if (templateName == null) {
            throw new IllegalArgumentException("Infinispan configuration does not define a default cache");
        }
        throw new IllegalArgumentException(String.format("No such configuration template: %s", templateName));
    }
    ConfigurationBuilder builder = new ConfigurationBuilder().read(template).template(false);
    builder.encoding().mediaType(MediaType.APPLICATION_OBJECT_TYPE);
    builder.clustering().hash().groups().enabled();
    // Disable expiration, if necessary
    ExpirationConfiguration expiration = builder.expiration().create();
    if ((expiration.lifespan() >= 0) || (expiration.maxIdle() >= 0)) {
        builder.expiration().lifespan(-1).maxIdle(-1);
    }
    EvictionStrategy eviction = (maxActiveSessions != null) ? EvictionStrategy.REMOVE : EvictionStrategy.MANUAL;
    builder.memory().storage(StorageType.HEAP).whenFull(eviction).maxCount((maxActiveSessions != null) ? maxActiveSessions.longValue() : -1);
    if (eviction.isEnabled()) {
        // Only evict creation meta-data entries
        // We will cascade eviction to the remaining entries for a given session
        builder.addModule(DataContainerConfigurationBuilder.class).evictable(SessionCreationMetaDataKey.class::isInstance);
    }
    container.defineConfiguration(deploymentName, builder.build());
    this.stopTasks.add(() -> container.undefineConfiguration(deploymentName));
    container.start();
    this.stopTasks.add(container::stop);
    ByteBufferMarshaller marshaller = marshallerFactory.apply(context.getClassLoader());
    MarshalledValueFactory<ByteBufferMarshaller> marshalledValueFactory = new ByteBufferMarshalledValueFactory(marshaller);
    ServiceLoader<Immutability> loadedImmutability = ServiceLoader.load(Immutability.class, Immutability.class.getClassLoader());
    Immutability immutability = new CompositeImmutability(new CompositeIterable<>(EnumSet.allOf(DefaultImmutability.class), EnumSet.allOf(SessionAttributeImmutability.class), EnumSet.allOf(SpringSecurityImmutability.class), loadedImmutability));
    Supplier<String> identifierFactory = this.configuration.getIdentifierFactory();
    KeyAffinityServiceFactory affinityFactory = new DefaultKeyAffinityServiceFactory();
    Map<String, String> indexes = this.configuration.getIndexes();
    Map<String, SSOManager<Void, String, String, Void, TransactionBatch>> managers = indexes.isEmpty() ? Collections.emptyMap() : new HashMap<>();
    for (Map.Entry<String, String> entry : indexes.entrySet()) {
        String cacheName = String.format("%s/%s", deploymentName, entry.getKey());
        String indexName = entry.getValue();
        container.defineConfiguration(cacheName, builder.build());
        this.stopTasks.add(() -> container.undefineConfiguration(cacheName));
        Cache<?, ?> cache = container.getCache(cacheName);
        cache.start();
        this.stopTasks.add(cache::stop);
        SSOManagerFactory<Void, String, String, TransactionBatch> ssoManagerFactory = new InfinispanSSOManagerFactory<>(new InfinispanSSOManagerFactoryConfiguration() {

            @Override
            public <K, V> Cache<K, V> getCache() {
                return container.getCache(cacheName);
            }

            @Override
            public KeyAffinityServiceFactory getKeyAffinityServiceFactory() {
                return affinityFactory;
            }
        });
        SSOManager<Void, String, String, Void, TransactionBatch> ssoManager = ssoManagerFactory.createSSOManager(new SSOManagerConfiguration<ByteBufferMarshaller, Void>() {

            @Override
            public Supplier<String> getIdentifierFactory() {
                return identifierFactory;
            }

            @Override
            public MarshalledValueFactory<ByteBufferMarshaller> getMarshalledValueFactory() {
                return marshalledValueFactory;
            }

            @Override
            public LocalContextFactory<Void> getLocalContextFactory() {
                return InfinispanSessionRepository.this;
            }
        });
        managers.put(indexName, ssoManager);
    }
    IndexResolver<Session> resolver = this.configuration.getIndexResolver();
    IndexingConfiguration<TransactionBatch> indexing = new IndexingConfiguration<TransactionBatch>() {

        @Override
        public Map<String, SSOManager<Void, String, String, Void, TransactionBatch>> getSSOManagers() {
            return managers;
        }

        @Override
        public IndexResolver<Session> getIndexResolver() {
            return resolver;
        }
    };
    Cache<?, ?> cache = container.getCache(deploymentName);
    cache.start();
    this.stopTasks.add(cache::stop);
    NodeFactory<org.jgroups.Address> memberFactory = (channel != null) ? (ChannelCommandDispatcherFactory) dispatcherFactory : new LocalGroup(context.getVirtualServerName());
    CacheGroup group = new CacheGroup(new CacheGroupConfiguration() {

        @Override
        public Cache<?, ?> getCache() {
            return cache;
        }

        @Override
        public NodeFactory<org.jgroups.Address> getMemberFactory() {
            return memberFactory;
        }
    });
    this.stopTasks.add(group::close);
    SessionManagerFactory<ServletContext, Void, TransactionBatch> managerFactory = new InfinispanSessionManagerFactory<>(new InfinispanSessionManagerFactoryConfiguration<HttpSession, ServletContext, HttpSessionActivationListener, ByteBufferMarshaller, Void>() {

        @Override
        public Integer getMaxActiveSessions() {
            return maxActiveSessions;
        }

        @Override
        public SessionAttributePersistenceStrategy getAttributePersistenceStrategy() {
            return strategy;
        }

        @Override
        public String getDeploymentName() {
            return deploymentName;
        }

        @Override
        public MarshalledValueFactory<ByteBufferMarshaller> getMarshalledValueFactory() {
            return marshalledValueFactory;
        }

        @Override
        public String getServerName() {
            return context.getVirtualServerName();
        }

        @Override
        public LocalContextFactory<Void> getLocalContextFactory() {
            return InfinispanSessionRepository.this;
        }

        @Override
        public <K, V> Cache<K, V> getCache() {
            return container.getCache(this.getDeploymentName());
        }

        @Override
        public Immutability getImmutability() {
            return immutability;
        }

        @Override
        public SpecificationProvider<HttpSession, ServletContext, HttpSessionActivationListener> getSpecificationProvider() {
            return SpringSpecificationProvider.INSTANCE;
        }

        @Override
        public CommandDispatcherFactory getCommandDispatcherFactory() {
            return dispatcherFactory;
        }

        @Override
        public KeyAffinityServiceFactory getKeyAffinityServiceFactory() {
            return affinityFactory;
        }

        @Override
        public NodeFactory<Address> getMemberFactory() {
            return group;
        }
    });
    this.stopTasks.add(managerFactory::close);
    ApplicationEventPublisher publisher = this.configuration.getEventPublisher();
    BiConsumer<ImmutableSession, BiFunction<Object, Session, ApplicationEvent>> sessionDestroyAction = new ImmutableSessionDestroyAction<>(publisher, context, indexing);
    SessionExpirationListener expirationListener = new ImmutableSessionExpirationListener(context, sessionDestroyAction);
    SessionManager<Void, TransactionBatch> manager = managerFactory.createSessionManager(new SessionManagerConfiguration<ServletContext>() {

        @Override
        public ServletContext getServletContext() {
            return context;
        }

        @Override
        public Supplier<String> getIdentifierFactory() {
            return identifierFactory;
        }

        @Override
        public SessionExpirationListener getExpirationListener() {
            return expirationListener;
        }

        @Override
        public Recordable<ImmutableSessionMetaData> getInactiveSessionRecorder() {
            // Spring session has no metrics capability
            return null;
        }
    });
    Optional<Duration> defaultTimeout = setDefaultMaxInactiveInterval(manager, Duration.ofMinutes(context.getSessionTimeout()));
    manager.start();
    this.stopTasks.add(manager::stop);
    this.repository = new DistributableSessionRepository<>(new DistributableSessionRepositoryConfiguration<TransactionBatch>() {

        @Override
        public SessionManager<Void, TransactionBatch> getSessionManager() {
            return manager;
        }

        @Override
        public Optional<Duration> getDefaultTimeout() {
            return defaultTimeout;
        }

        @Override
        public ApplicationEventPublisher getEventPublisher() {
            return publisher;
        }

        @Override
        public ServletContext getServletContext() {
            return context;
        }

        @Override
        public BiConsumer<ImmutableSession, BiFunction<Object, Session, ApplicationEvent>> getSessionDestroyAction() {
            return sessionDestroyAction;
        }

        @Override
        public IndexingConfiguration<TransactionBatch> getIndexingConfiguration() {
            return indexing;
        }
    });
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) SpringSpecificationProvider(org.wildfly.clustering.web.spring.SpringSpecificationProvider) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) IndexResolver(org.springframework.session.IndexResolver) Cache(org.infinispan.Cache) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) DefaultNonBlockingThreadFactory(org.wildfly.clustering.infinispan.spi.DefaultNonBlockingThreadFactory) ConfigurationBuilderHolder(org.infinispan.configuration.parsing.ConfigurationBuilderHolder) Duration(java.time.Duration) Map(java.util.Map) LocalGroup(org.wildfly.clustering.server.group.LocalGroup) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) LocalContextFactory(org.wildfly.clustering.web.LocalContextFactory) EnumSet(java.util.EnumSet) SpecificationProvider(org.wildfly.clustering.web.session.SpecificationProvider) CacheGroupConfiguration(org.wildfly.clustering.server.group.CacheGroupConfiguration) JGroupsTransport(org.infinispan.remoting.transport.jgroups.JGroupsTransport) ContextClassLoaderReference(org.jboss.as.clustering.context.ContextClassLoaderReference) ImmutableSessionMetaData(org.wildfly.clustering.web.session.ImmutableSessionMetaData) InfinispanSSOManagerFactory(org.wildfly.clustering.web.infinispan.sso.InfinispanSSOManagerFactory) Registration(org.wildfly.clustering.Registration) InfinispanSessionManagerFactory(org.wildfly.clustering.web.infinispan.session.InfinispanSessionManagerFactory) WildFlySecurityManager(org.wildfly.security.manager.WildFlySecurityManager) DisposableBean(org.springframework.beans.factory.DisposableBean) JChannel(org.jgroups.JChannel) SessionManagerConfiguration(org.wildfly.clustering.web.session.SessionManagerConfiguration) DefaultImmutability(org.wildfly.clustering.ee.immutable.DefaultImmutability) ExpirationConfiguration(org.infinispan.configuration.cache.ExpirationConfiguration) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) Supplier(java.util.function.Supplier) InfinispanSSOManagerFactoryConfiguration(org.wildfly.clustering.web.infinispan.sso.InfinispanSSOManagerFactoryConfiguration) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) MarshalledValueFactory(org.wildfly.clustering.marshalling.spi.MarshalledValueFactory) SerializationContextInitializer(org.infinispan.protostream.SerializationContextInitializer) BiConsumer(java.util.function.BiConsumer) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable) KeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.KeyAffinityServiceFactory) ManagementFactory(java.lang.management.ManagementFactory) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) SessionCreationMetaDataKey(org.wildfly.clustering.web.infinispan.session.SessionCreationMetaDataKey) Address(org.infinispan.remoting.transport.Address) SessionAttributePersistenceStrategy(org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy) SessionMarshallerFactory(org.wildfly.clustering.web.spring.SessionMarshallerFactory) Properties(java.util.Properties) StorageType(org.infinispan.configuration.cache.StorageType) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) SpringSession(org.wildfly.clustering.web.spring.SpringSession) LocalCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.LocalCommandDispatcherFactory) SimpleClassLoaderMarshaller(org.wildfly.clustering.marshalling.protostream.SimpleClassLoaderMarshaller) ApplicationEvent(org.springframework.context.ApplicationEvent) Recordable(org.wildfly.clustering.ee.Recordable) EvictionStrategy(org.infinispan.eviction.EvictionStrategy) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) SSOManagerFactory(org.wildfly.clustering.web.sso.SSOManagerFactory) DefaultThreadFactory(org.jboss.as.clustering.context.DefaultThreadFactory) DefaultKeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.DefaultKeyAffinityServiceFactory) DistributableSessionRepository(org.wildfly.clustering.web.spring.DistributableSessionRepository) ServletContext(javax.servlet.ServletContext) SerializationContext(org.infinispan.protostream.SerializationContext) ListIterator(java.util.ListIterator) URL(java.net.URL) GlobalJmxConfiguration(org.infinispan.configuration.global.GlobalJmxConfiguration) BiFunction(java.util.function.BiFunction) SSOManager(org.wildfly.clustering.web.sso.SSOManager) Contextualizer(org.jboss.as.clustering.context.Contextualizer) TransactionBatch(org.wildfly.clustering.ee.cache.tx.TransactionBatch) NodeFactory(org.wildfly.clustering.spi.NodeFactory) ByteBuffer(java.nio.ByteBuffer) SessionManager(org.wildfly.clustering.web.session.SessionManager) SpringSecurityImmutability(org.wildfly.clustering.web.spring.security.SpringSecurityImmutability) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ContextReferenceExecutor(org.jboss.as.clustering.context.ContextReferenceExecutor) FindByIndexNameSessionRepository(org.springframework.session.FindByIndexNameSessionRepository) HttpSession(javax.servlet.http.HttpSession) SessionManagerFactory(org.wildfly.clustering.web.session.SessionManagerFactory) Predicate(java.util.function.Predicate) CacheGroup(org.wildfly.clustering.server.group.CacheGroup) ServiceLoader(java.util.ServiceLoader) ObjectName(javax.management.ObjectName) ChannelCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactory) FileNotFoundException(java.io.FileNotFoundException) List(java.util.List) ChannelCommandDispatcherFactoryConfiguration(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactoryConfiguration) ConfigurationStorage(org.infinispan.globalstate.ConfigurationStorage) Optional(java.util.Optional) DataContainerConfigurationBuilder(org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder) ImmutableSessionDestroyAction(org.wildfly.clustering.web.spring.ImmutableSessionDestroyAction) JmxConfigurator(org.jgroups.jmx.JmxConfigurator) SSOManagerConfiguration(org.wildfly.clustering.web.sso.SSOManagerConfiguration) HashMap(java.util.HashMap) ByteBufferMarshaller(org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller) Function(java.util.function.Function) InitializingBean(org.springframework.beans.factory.InitializingBean) Schedulers(io.reactivex.rxjava3.schedulers.Schedulers) MediaType(org.infinispan.commons.dataconversion.MediaType) ExpirationManager(org.infinispan.expiration.ExpirationManager) Registrar(org.wildfly.clustering.Registrar) Immutability(org.wildfly.clustering.ee.Immutability) InfinispanSessionManagerFactoryConfiguration(org.wildfly.clustering.web.infinispan.session.InfinispanSessionManagerFactoryConfiguration) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) LinkedList(java.util.LinkedList) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) SessionAttributeImmutability(org.wildfly.clustering.web.session.SessionAttributeImmutability) InfinispanProtoStreamMarshaller(org.wildfly.clustering.infinispan.spi.marshalling.InfinispanProtoStreamMarshaller) ListenerInvocation(org.infinispan.notifications.impl.ListenerInvocation) NonBlockingManager(org.infinispan.util.concurrent.NonBlockingManager) Session(org.springframework.session.Session) SessionExpirationListener(org.wildfly.clustering.web.session.SessionExpirationListener) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Configuration(org.infinispan.configuration.cache.Configuration) ParserRegistry(org.infinispan.configuration.parsing.ParserRegistry) JGroupsChannelConfigurator(org.infinispan.remoting.transport.jgroups.JGroupsChannelConfigurator) CommandDispatcherFactory(org.wildfly.clustering.spi.dispatcher.CommandDispatcherFactory) BlockingManager(org.infinispan.util.concurrent.BlockingManager) Collections(java.util.Collections) MarshalledValueFactory(org.wildfly.clustering.marshalling.spi.MarshalledValueFactory) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DataContainerConfigurationBuilder(org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder) JChannel(org.jgroups.JChannel) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) CacheGroupConfiguration(org.wildfly.clustering.server.group.CacheGroupConfiguration) SessionManagerConfiguration(org.wildfly.clustering.web.session.SessionManagerConfiguration) ExpirationConfiguration(org.infinispan.configuration.cache.ExpirationConfiguration) InfinispanSSOManagerFactoryConfiguration(org.wildfly.clustering.web.infinispan.sso.InfinispanSSOManagerFactoryConfiguration) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) GlobalJmxConfiguration(org.infinispan.configuration.global.GlobalJmxConfiguration) ChannelCommandDispatcherFactoryConfiguration(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactoryConfiguration) SSOManagerConfiguration(org.wildfly.clustering.web.sso.SSOManagerConfiguration) InfinispanSessionManagerFactoryConfiguration(org.wildfly.clustering.web.infinispan.session.InfinispanSessionManagerFactoryConfiguration) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Configuration(org.infinispan.configuration.cache.Configuration) Address(org.infinispan.remoting.transport.Address) CacheGroup(org.wildfly.clustering.server.group.CacheGroup) FileNotFoundException(java.io.FileNotFoundException) SerializationContextInitializer(org.infinispan.protostream.SerializationContextInitializer) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) InfinispanSSOManagerFactory(org.wildfly.clustering.web.infinispan.sso.InfinispanSSOManagerFactory) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) SessionExpirationListener(org.wildfly.clustering.web.session.SessionExpirationListener) GlobalJmxConfiguration(org.infinispan.configuration.global.GlobalJmxConfiguration) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) ByteBufferMarshaller(org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller) ExpirationManager(org.infinispan.expiration.ExpirationManager) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) DefaultImmutability(org.wildfly.clustering.ee.immutable.DefaultImmutability) SpringSecurityImmutability(org.wildfly.clustering.web.spring.security.SpringSecurityImmutability) Immutability(org.wildfly.clustering.ee.Immutability) SessionAttributeImmutability(org.wildfly.clustering.web.session.SessionAttributeImmutability) SessionCreationMetaDataKey(org.wildfly.clustering.web.infinispan.session.SessionCreationMetaDataKey) SpringSpecificationProvider(org.wildfly.clustering.web.spring.SpringSpecificationProvider) SpecificationProvider(org.wildfly.clustering.web.session.SpecificationProvider) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) Map(java.util.Map) HashMap(java.util.HashMap) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) SerializationContext(org.infinispan.protostream.SerializationContext) Contextualizer(org.jboss.as.clustering.context.Contextualizer) InfinispanSessionManagerFactory(org.wildfly.clustering.web.infinispan.session.InfinispanSessionManagerFactory) SimpleClassLoaderMarshaller(org.wildfly.clustering.marshalling.protostream.SimpleClassLoaderMarshaller) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) URL(java.net.URL) ImmutableSessionDestroyAction(org.wildfly.clustering.web.spring.ImmutableSessionDestroyAction) Supplier(java.util.function.Supplier) DataContainerConfigurationBuilder(org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder) TransactionBatch(org.wildfly.clustering.ee.cache.tx.TransactionBatch) HttpSession(javax.servlet.http.HttpSession) SessionAttributePersistenceStrategy(org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy) ParserRegistry(org.infinispan.configuration.parsing.ParserRegistry) NonBlockingManager(org.infinispan.util.concurrent.NonBlockingManager) ContextReferenceExecutor(org.jboss.as.clustering.context.ContextReferenceExecutor) BiFunction(java.util.function.BiFunction) LocalCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.LocalCommandDispatcherFactory) DefaultThreadFactory(org.jboss.as.clustering.context.DefaultThreadFactory) JGroupsChannelConfigurator(org.infinispan.remoting.transport.jgroups.JGroupsChannelConfigurator) LocalCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.LocalCommandDispatcherFactory) ChannelCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactory) CommandDispatcherFactory(org.wildfly.clustering.spi.dispatcher.CommandDispatcherFactory) ListenerInvocation(org.infinispan.notifications.impl.ListenerInvocation) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) InfinispanSSOManagerFactoryConfiguration(org.wildfly.clustering.web.infinispan.sso.InfinispanSSOManagerFactoryConfiguration) ChannelCommandDispatcherFactory(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactory) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) ChannelCommandDispatcherFactoryConfiguration(org.wildfly.clustering.server.dispatcher.ChannelCommandDispatcherFactoryConfiguration) Duration(java.time.Duration) KeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.KeyAffinityServiceFactory) DefaultKeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.DefaultKeyAffinityServiceFactory) NodeFactory(org.wildfly.clustering.spi.NodeFactory) DefaultNonBlockingThreadFactory(org.wildfly.clustering.infinispan.spi.DefaultNonBlockingThreadFactory) DefaultKeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.DefaultKeyAffinityServiceFactory) Cache(org.infinispan.Cache) SSOManager(org.wildfly.clustering.web.sso.SSOManager) InfinispanProtoStreamMarshaller(org.wildfly.clustering.infinispan.spi.marshalling.InfinispanProtoStreamMarshaller) NonBlockingManager(org.infinispan.util.concurrent.NonBlockingManager) BlockingManager(org.infinispan.util.concurrent.BlockingManager) LocalGroup(org.wildfly.clustering.server.group.LocalGroup) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Properties(java.util.Properties) ServletContext(javax.servlet.ServletContext) EvictionStrategy(org.infinispan.eviction.EvictionStrategy) ExpirationConfiguration(org.infinispan.configuration.cache.ExpirationConfiguration) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) ByteBuffer(java.nio.ByteBuffer) FileNotFoundException(java.io.FileNotFoundException) LocalContextFactory(org.wildfly.clustering.web.LocalContextFactory) Recordable(org.wildfly.clustering.ee.Recordable) ObjectName(javax.management.ObjectName) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConfigurationBuilderHolder(org.infinispan.configuration.parsing.ConfigurationBuilderHolder) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) CacheGroupConfiguration(org.wildfly.clustering.server.group.CacheGroupConfiguration) SpringSession(org.wildfly.clustering.web.spring.SpringSession) HttpSession(javax.servlet.http.HttpSession) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) Session(org.springframework.session.Session)

Example 2 with ImmutableSessionExpirationListener

use of org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener in project wildfly-clustering-spring-session by wildfly-clustering.

the class HotRodSessionRepository method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    ServletContext context = this.configuration.getServletContext();
    // Deployment name = host name + context path + version
    String deploymentName = context.getVirtualServerName() + context.getContextPath();
    String templateName = this.configuration.getTemplateName();
    Integer maxActiveSessions = this.configuration.getMaxActiveSessions();
    SessionAttributePersistenceStrategy strategy = this.configuration.getPersistenceStrategy();
    ClassLoader containerLoader = WildFlySecurityManager.getClassLoaderPrivileged(HotRodSessionManagerFactory.class);
    URI uri = this.configuration.getUri();
    Configuration configuration = ((uri != null) ? HotRodURI.create(uri).toConfigurationBuilder() : new ConfigurationBuilder()).withProperties(this.configuration.getProperties()).marshaller(new ProtoStreamMarshaller(new SimpleClassLoaderMarshaller(containerLoader), builder -> builder.load(containerLoader))).classLoader(containerLoader).build();
    configuration.addRemoteCache(deploymentName, builder -> builder.forceReturnValues(false).nearCacheMode((maxActiveSessions == null) || (maxActiveSessions.intValue() <= 0) ? NearCacheMode.DISABLED : NearCacheMode.INVALIDATED).transactionMode(TransactionMode.NONE).templateName(templateName));
    RemoteCacheContainer container = new RemoteCacheManager(this.getClass().getName(), configuration, this);
    container.start();
    this.stopTasks.add(container::stop);
    ByteBufferMarshaller marshaller = this.configuration.getMarshallerFactory().apply(context.getClassLoader());
    MarshalledValueFactory<ByteBufferMarshaller> marshalledValueFactory = new ByteBufferMarshalledValueFactory(marshaller);
    ServiceLoader<Immutability> loadedImmutability = ServiceLoader.load(Immutability.class, Immutability.class.getClassLoader());
    Immutability immutability = new CompositeImmutability(new CompositeIterable<>(EnumSet.allOf(DefaultImmutability.class), EnumSet.allOf(SessionAttributeImmutability.class), EnumSet.allOf(SpringSecurityImmutability.class), loadedImmutability));
    SessionManagerFactory<ServletContext, Void, TransactionBatch> managerFactory = new HotRodSessionManagerFactory<>(new HotRodSessionManagerFactoryConfiguration<HttpSession, ServletContext, HttpSessionActivationListener, ByteBufferMarshaller, Void>() {

        @Override
        public Integer getMaxActiveSessions() {
            return maxActiveSessions;
        }

        @Override
        public SessionAttributePersistenceStrategy getAttributePersistenceStrategy() {
            return strategy;
        }

        @Override
        public String getDeploymentName() {
            return deploymentName;
        }

        @Override
        public MarshalledValueFactory<ByteBufferMarshaller> getMarshalledValueFactory() {
            return marshalledValueFactory;
        }

        @Override
        public String getServerName() {
            return context.getVirtualServerName();
        }

        @Override
        public LocalContextFactory<Void> getLocalContextFactory() {
            return HotRodSessionRepository.this;
        }

        @Override
        public <K, V> RemoteCache<K, V> getCache() {
            String cacheName = this.getDeploymentName();
            try (RemoteCacheContainer.NearCacheRegistration registration = container.registerNearCacheFactory(cacheName, new SessionManagerNearCacheFactory<>(this.getMaxActiveSessions(), this.getAttributePersistenceStrategy()))) {
                return container.getCache(cacheName);
            }
        }

        @Override
        public Immutability getImmutability() {
            return immutability;
        }

        @Override
        public SpecificationProvider<HttpSession, ServletContext, HttpSessionActivationListener> getSpecificationProvider() {
            return SpringSpecificationProvider.INSTANCE;
        }
    });
    this.stopTasks.add(managerFactory::close);
    Supplier<String> identifierFactory = this.configuration.getIdentifierFactory();
    Map<String, String> indexes = this.configuration.getIndexes();
    Map<String, SSOManager<Void, String, String, Void, TransactionBatch>> managers = indexes.isEmpty() ? Collections.emptyMap() : new HashMap<>();
    for (Map.Entry<String, String> entry : indexes.entrySet()) {
        String cacheName = String.format("%s/%s", deploymentName, entry.getKey());
        String indexName = entry.getValue();
        configuration.addRemoteCache(cacheName, builder -> builder.forceReturnValues(false).nearCacheMode(NearCacheMode.DISABLED).transactionMode(TransactionMode.NONE).templateName(templateName));
        SSOManagerFactory<Void, String, String, TransactionBatch> ssoManagerFactory = new HotRodSSOManagerFactory<>(new HotRodSSOManagerFactoryConfiguration() {

            @Override
            public <K, V> RemoteCache<K, V> getRemoteCache() {
                return container.getCache(cacheName);
            }
        });
        SSOManager<Void, String, String, Void, TransactionBatch> ssoManager = ssoManagerFactory.createSSOManager(new SSOManagerConfiguration<ByteBufferMarshaller, Void>() {

            @Override
            public Supplier<String> getIdentifierFactory() {
                return identifierFactory;
            }

            @Override
            public MarshalledValueFactory<ByteBufferMarshaller> getMarshalledValueFactory() {
                return marshalledValueFactory;
            }

            @Override
            public LocalContextFactory<Void> getLocalContextFactory() {
                return HotRodSessionRepository.this;
            }
        });
        managers.put(indexName, ssoManager);
    }
    IndexResolver<Session> resolver = this.configuration.getIndexResolver();
    IndexingConfiguration<TransactionBatch> indexing = new IndexingConfiguration<TransactionBatch>() {

        @Override
        public Map<String, SSOManager<Void, String, String, Void, TransactionBatch>> getSSOManagers() {
            return managers;
        }

        @Override
        public IndexResolver<Session> getIndexResolver() {
            return resolver;
        }
    };
    ApplicationEventPublisher publisher = this.configuration.getEventPublisher();
    BiConsumer<ImmutableSession, BiFunction<Object, Session, ApplicationEvent>> sessionDestroyAction = new ImmutableSessionDestroyAction<>(publisher, context, indexing);
    SessionExpirationListener expirationListener = new ImmutableSessionExpirationListener(context, sessionDestroyAction);
    SessionManager<Void, TransactionBatch> manager = managerFactory.createSessionManager(new SessionManagerConfiguration<ServletContext>() {

        @Override
        public ServletContext getServletContext() {
            return context;
        }

        @Override
        public Supplier<String> getIdentifierFactory() {
            return identifierFactory;
        }

        @Override
        public SessionExpirationListener getExpirationListener() {
            return expirationListener;
        }

        @Override
        public Recordable<ImmutableSessionMetaData> getInactiveSessionRecorder() {
            // Spring session has no metrics capability
            return null;
        }
    });
    Optional<Duration> defaultTimeout = setDefaultMaxInactiveInterval(manager, Duration.ofMinutes(context.getSessionTimeout()));
    manager.start();
    this.stopTasks.add(manager::stop);
    this.repository = new DistributableSessionRepository<>(new DistributableSessionRepositoryConfiguration<TransactionBatch>() {

        @Override
        public SessionManager<Void, TransactionBatch> getSessionManager() {
            return manager;
        }

        @Override
        public Optional<Duration> getDefaultTimeout() {
            return defaultTimeout;
        }

        @Override
        public ApplicationEventPublisher getEventPublisher() {
            return publisher;
        }

        @Override
        public ServletContext getServletContext() {
            return context;
        }

        @Override
        public BiConsumer<ImmutableSession, BiFunction<Object, Session, ApplicationEvent>> getSessionDestroyAction() {
            return sessionDestroyAction;
        }

        @Override
        public IndexingConfiguration<TransactionBatch> getIndexingConfiguration() {
            return indexing;
        }
    });
}
Also used : ListIterator(java.util.ListIterator) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) SpringSpecificationProvider(org.wildfly.clustering.web.spring.SpringSpecificationProvider) BiFunction(java.util.function.BiFunction) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) IndexResolver(org.springframework.session.IndexResolver) SSOManager(org.wildfly.clustering.web.sso.SSOManager) RemoteCache(org.infinispan.client.hotrod.RemoteCache) TransactionBatch(org.wildfly.clustering.ee.cache.tx.TransactionBatch) SessionManager(org.wildfly.clustering.web.session.SessionManager) SpringSecurityImmutability(org.wildfly.clustering.web.spring.security.SpringSecurityImmutability) HotRodSessionManagerFactory(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagerFactory) Duration(java.time.Duration) Map(java.util.Map) HotRodSSOManagerFactoryConfiguration(org.wildfly.clustering.web.hotrod.sso.HotRodSSOManagerFactoryConfiguration) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) TransactionMode(org.infinispan.client.hotrod.configuration.TransactionMode) LocalContextFactory(org.wildfly.clustering.web.LocalContextFactory) URI(java.net.URI) FindByIndexNameSessionRepository(org.springframework.session.FindByIndexNameSessionRepository) EnumSet(java.util.EnumSet) HttpSession(javax.servlet.http.HttpSession) SpecificationProvider(org.wildfly.clustering.web.session.SpecificationProvider) SessionManagerFactory(org.wildfly.clustering.web.session.SessionManagerFactory) ImmutableSessionMetaData(org.wildfly.clustering.web.session.ImmutableSessionMetaData) RemoteCacheManager(org.wildfly.clustering.infinispan.client.manager.RemoteCacheManager) ServiceLoader(java.util.ServiceLoader) HotRodSSOManagerFactory(org.wildfly.clustering.web.hotrod.sso.HotRodSSOManagerFactory) Registration(org.wildfly.clustering.Registration) List(java.util.List) WildFlySecurityManager(org.wildfly.security.manager.WildFlySecurityManager) HotRodSessionManagerFactoryConfiguration(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagerFactoryConfiguration) DisposableBean(org.springframework.beans.factory.DisposableBean) Optional(java.util.Optional) ImmutableSessionDestroyAction(org.wildfly.clustering.web.spring.ImmutableSessionDestroyAction) SessionManagerConfiguration(org.wildfly.clustering.web.session.SessionManagerConfiguration) SessionManagerNearCacheFactory(org.wildfly.clustering.web.hotrod.session.SessionManagerNearCacheFactory) DefaultImmutability(org.wildfly.clustering.ee.immutable.DefaultImmutability) HotRodURI(org.infinispan.client.hotrod.impl.HotRodURI) SSOManagerConfiguration(org.wildfly.clustering.web.sso.SSOManagerConfiguration) HashMap(java.util.HashMap) ByteBufferMarshaller(org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) Supplier(java.util.function.Supplier) InitializingBean(org.springframework.beans.factory.InitializingBean) MarshalledValueFactory(org.wildfly.clustering.marshalling.spi.MarshalledValueFactory) Registrar(org.wildfly.clustering.Registrar) Immutability(org.wildfly.clustering.ee.Immutability) BiConsumer(java.util.function.BiConsumer) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable) LinkedList(java.util.LinkedList) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) RemoteCacheContainer(org.wildfly.clustering.infinispan.client.RemoteCacheContainer) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) SessionAttributeImmutability(org.wildfly.clustering.web.session.SessionAttributeImmutability) SessionAttributePersistenceStrategy(org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy) Configuration(org.infinispan.client.hotrod.configuration.Configuration) ConfigurationBuilder(org.infinispan.client.hotrod.configuration.ConfigurationBuilder) Session(org.springframework.session.Session) SessionExpirationListener(org.wildfly.clustering.web.session.SessionExpirationListener) SpringSession(org.wildfly.clustering.web.spring.SpringSession) SimpleClassLoaderMarshaller(org.wildfly.clustering.marshalling.protostream.SimpleClassLoaderMarshaller) ApplicationEvent(org.springframework.context.ApplicationEvent) Recordable(org.wildfly.clustering.ee.Recordable) NearCacheMode(org.infinispan.client.hotrod.configuration.NearCacheMode) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) SSOManagerFactory(org.wildfly.clustering.web.sso.SSOManagerFactory) DistributableSessionRepository(org.wildfly.clustering.web.spring.DistributableSessionRepository) ServletContext(javax.servlet.ServletContext) ProtoStreamMarshaller(org.wildfly.clustering.infinispan.marshalling.protostream.ProtoStreamMarshaller) Collections(java.util.Collections) MarshalledValueFactory(org.wildfly.clustering.marshalling.spi.MarshalledValueFactory) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) ConfigurationBuilder(org.infinispan.client.hotrod.configuration.ConfigurationBuilder) HotRodSSOManagerFactory(org.wildfly.clustering.web.hotrod.sso.HotRodSSOManagerFactory) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) HotRodSSOManagerFactoryConfiguration(org.wildfly.clustering.web.hotrod.sso.HotRodSSOManagerFactoryConfiguration) HotRodSessionManagerFactoryConfiguration(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagerFactoryConfiguration) SessionManagerConfiguration(org.wildfly.clustering.web.session.SessionManagerConfiguration) SSOManagerConfiguration(org.wildfly.clustering.web.sso.SSOManagerConfiguration) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) Configuration(org.infinispan.client.hotrod.configuration.Configuration) RemoteCacheContainer(org.wildfly.clustering.infinispan.client.RemoteCacheContainer) DistributableSessionRepositoryConfiguration(org.wildfly.clustering.web.spring.DistributableSessionRepositoryConfiguration) SessionExpirationListener(org.wildfly.clustering.web.session.SessionExpirationListener) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) ByteBufferMarshaller(org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller) ImmutableSessionExpirationListener(org.wildfly.clustering.web.spring.ImmutableSessionExpirationListener) Duration(java.time.Duration) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) SpringSecurityImmutability(org.wildfly.clustering.web.spring.security.SpringSecurityImmutability) DefaultImmutability(org.wildfly.clustering.ee.immutable.DefaultImmutability) Immutability(org.wildfly.clustering.ee.Immutability) SessionAttributeImmutability(org.wildfly.clustering.web.session.SessionAttributeImmutability) RemoteCacheManager(org.wildfly.clustering.infinispan.client.manager.RemoteCacheManager) SpringSpecificationProvider(org.wildfly.clustering.web.spring.SpringSpecificationProvider) SpecificationProvider(org.wildfly.clustering.web.session.SpecificationProvider) ByteBufferMarshalledValueFactory(org.wildfly.clustering.marshalling.spi.ByteBufferMarshalledValueFactory) HotRodSessionManagerFactory(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagerFactory) RemoteCache(org.infinispan.client.hotrod.RemoteCache) Map(java.util.Map) HashMap(java.util.HashMap) SSOManager(org.wildfly.clustering.web.sso.SSOManager) SessionManagerNearCacheFactory(org.wildfly.clustering.web.hotrod.session.SessionManagerNearCacheFactory) SimpleClassLoaderMarshaller(org.wildfly.clustering.marshalling.protostream.SimpleClassLoaderMarshaller) URI(java.net.URI) HotRodURI(org.infinispan.client.hotrod.impl.HotRodURI) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) ImmutableSessionDestroyAction(org.wildfly.clustering.web.spring.ImmutableSessionDestroyAction) ProtoStreamMarshaller(org.wildfly.clustering.infinispan.marshalling.protostream.ProtoStreamMarshaller) ServletContext(javax.servlet.ServletContext) Supplier(java.util.function.Supplier) TransactionBatch(org.wildfly.clustering.ee.cache.tx.TransactionBatch) HttpSession(javax.servlet.http.HttpSession) IndexingConfiguration(org.wildfly.clustering.web.spring.IndexingConfiguration) SessionAttributePersistenceStrategy(org.wildfly.clustering.web.session.SessionAttributePersistenceStrategy) LocalContextFactory(org.wildfly.clustering.web.LocalContextFactory) Recordable(org.wildfly.clustering.ee.Recordable) HotRodSSOManagerFactoryConfiguration(org.wildfly.clustering.web.hotrod.sso.HotRodSSOManagerFactoryConfiguration) BiFunction(java.util.function.BiFunction) CompositeImmutability(org.wildfly.clustering.ee.immutable.CompositeImmutability) HttpSession(javax.servlet.http.HttpSession) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) Session(org.springframework.session.Session) SpringSession(org.wildfly.clustering.web.spring.SpringSession)

Aggregations

Duration (java.time.Duration)2 Collections (java.util.Collections)2 EnumSet (java.util.EnumSet)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 ListIterator (java.util.ListIterator)2 Map (java.util.Map)2 Optional (java.util.Optional)2 ServiceLoader (java.util.ServiceLoader)2 BiConsumer (java.util.function.BiConsumer)2 BiFunction (java.util.function.BiFunction)2 Supplier (java.util.function.Supplier)2 ServletContext (javax.servlet.ServletContext)2 HttpSession (javax.servlet.http.HttpSession)2 HttpSessionActivationListener (javax.servlet.http.HttpSessionActivationListener)2 DisposableBean (org.springframework.beans.factory.DisposableBean)2 InitializingBean (org.springframework.beans.factory.InitializingBean)2 ApplicationEvent (org.springframework.context.ApplicationEvent)2 ApplicationEventPublisher (org.springframework.context.ApplicationEventPublisher)2