Search in sources :

Example 1 with SessionFilter

use of org.wildfly.clustering.web.cache.sso.coarse.SessionFilter in project wildfly by wildfly.

the class CoarseSessionsFactory method findEntryContaining.

@Override
public Map.Entry<String, Map<D, S>> findEntryContaining(S session) {
    SessionFilter<CoarseSessionsKey, D, S> filter = new SessionFilter<>(session);
    // Erase type to handle compilation issues with generics
    // Our filter will handle type safety and casting
    @SuppressWarnings("rawtypes") Cache cache = this.cache;
    try (Stream<Map.Entry<?, ?>> stream = cache.entrySet().stream()) {
        Map.Entry<CoarseSessionsKey, Map<D, S>> entry = stream.filter(this.filter).map(this.filter).filter(filter).findAny().orElse(null);
        return (entry != null) ? new AbstractMap.SimpleImmutableEntry<>(entry.getKey().getId(), entry.getValue()) : null;
    }
}
Also used : AbstractMap(java.util.AbstractMap) SessionFilter(org.wildfly.clustering.web.cache.sso.coarse.SessionFilter) AbstractMap(java.util.AbstractMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Cache(org.infinispan.Cache)

Example 2 with SessionFilter

use of org.wildfly.clustering.web.cache.sso.coarse.SessionFilter in project wildfly by wildfly.

the class CoarseSessionsFactory method findEntryContaining.

@Override
public Map.Entry<String, Map<D, S>> findEntryContaining(S session) {
    SessionFilter<CoarseSessionsKey, D, S> filter = new SessionFilter<>(session);
    // Erase type to handle compilation issues with generics
    // Our filter will handle type safety and casting
    @SuppressWarnings("rawtypes") RemoteCache cache = this.cache;
    try (Stream<Map.Entry<?, ?>> stream = cache.entrySet().stream()) {
        Map.Entry<CoarseSessionsKey, Map<D, S>> entry = stream.filter(this.filter).map(this.filter).filter(filter).findAny().orElse(null);
        return (entry != null) ? new AbstractMap.SimpleImmutableEntry<>(entry.getKey().getId(), entry.getValue()) : null;
    }
}
Also used : AbstractMap(java.util.AbstractMap) SessionFilter(org.wildfly.clustering.web.cache.sso.coarse.SessionFilter) RemoteCache(org.infinispan.client.hotrod.RemoteCache) AbstractMap(java.util.AbstractMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

AbstractMap (java.util.AbstractMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 SessionFilter (org.wildfly.clustering.web.cache.sso.coarse.SessionFilter)2 Cache (org.infinispan.Cache)1 RemoteCache (org.infinispan.client.hotrod.RemoteCache)1