Search in sources :

Example 1 with ValidSession

use of org.wildfly.clustering.web.cache.session.ValidSession in project wildfly by wildfly.

the class HotRodSessionManager method findSession.

@Override
public Session<LC> findSession(String id) {
    Map.Entry<MV, AV> entry = this.factory.findValue(id);
    if (entry == null) {
        Logger.ROOT_LOGGER.tracef("Session %s not found", id);
        return null;
    }
    ImmutableSession session = this.factory.createImmutableSession(id, entry);
    if (session.getMetaData().isExpired()) {
        Logger.ROOT_LOGGER.tracef("Session %s was found, but has expired", id);
        this.expirationListener.sessionExpired(session);
        this.factory.remove(id);
        return null;
    }
    return new ValidSession<>(this.factory.createSession(id, entry, this.context), this.closeTask);
}
Also used : SimpleImmutableSession(org.wildfly.clustering.web.cache.session.SimpleImmutableSession) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) ValidSession(org.wildfly.clustering.web.cache.session.ValidSession) Map(java.util.Map)

Example 2 with ValidSession

use of org.wildfly.clustering.web.cache.session.ValidSession in project wildfly by wildfly.

the class InfinispanSessionManager method findSession.

@Override
public Session<LC> findSession(String id) {
    Map.Entry<MV, AV> value = this.factory.findValue(id);
    if (value == null) {
        InfinispanWebLogger.ROOT_LOGGER.tracef("Session %s not found", id);
        return null;
    }
    ImmutableSession session = this.factory.createImmutableSession(id, value);
    if (session.getMetaData().isExpired()) {
        InfinispanWebLogger.ROOT_LOGGER.tracef("Session %s was found, but has expired", id);
        this.expirationListener.sessionExpired(session);
        this.factory.remove(id);
        return null;
    }
    this.expirationScheduler.cancel(id);
    return new ValidSession<>(this.factory.createSession(id, value, this.context), this.closeTask);
}
Also used : ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) SimpleImmutableSession(org.wildfly.clustering.web.cache.session.SimpleImmutableSession) ValidSession(org.wildfly.clustering.web.cache.session.ValidSession) Map(java.util.Map)

Aggregations

Map (java.util.Map)2 SimpleImmutableSession (org.wildfly.clustering.web.cache.session.SimpleImmutableSession)2 ValidSession (org.wildfly.clustering.web.cache.session.ValidSession)2 ImmutableSession (org.wildfly.clustering.web.session.ImmutableSession)2