org.wildfly.clustering.web.undertow.session.DistributableSessionManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-web-undertow Show documentation
Show all versions of wildfly-clustering-web-undertow Show documentation
This module adapts an implementation of wildfly-clustering-web-spi to the Undertow servlet container.
The newest version!
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.web.undertow.session;
import java.util.Collections;
import java.util.Map;
import java.util.OptionalLong;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.StampedLock;
import java.util.function.Consumer;
import java.util.function.LongConsumer;
import io.undertow.UndertowMessages;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.session.SessionConfig;
import io.undertow.server.session.SessionListener;
import io.undertow.server.session.SessionListeners;
import io.undertow.server.session.SessionManagerStatistics;
import io.undertow.util.AttachmentKey;
import org.wildfly.clustering.cache.batch.Batch;
import org.wildfly.clustering.session.IdentifierMarshaller;
import org.wildfly.clustering.session.Session;
import org.wildfly.clustering.session.SessionManager;
import org.wildfly.clustering.web.undertow.UndertowIdentifierSerializerProvider;
import org.wildfly.clustering.web.undertow.logging.UndertowClusteringLogger;
import org.wildfly.common.function.Functions;
/**
* Adapts a distributable {@link SessionManager} to an Undertow {@link io.undertow.server.session.SessionManager}.
* @author Paul Ferraro
*/
public class DistributableSessionManager implements UndertowSessionManager, LongConsumer {
private static final IdentifierMarshaller IDENTIFIER_MARSHALLER = new UndertowIdentifierSerializerProvider().getMarshaller();
private final AttachmentKey key = AttachmentKey.create(io.undertow.server.session.Session.class);
private final String deploymentName;
private final SessionListeners listeners;
private final SessionManager