diff --git a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java
index 3675470..12019c1 100644
--- a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java
+++ b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanAuthenticationSessionProvider.java
@@ -120,7 +120,7 @@ public class InfinispanAuthenticationSessionProvider implements AuthenticationSe
while (itr.hasNext()) {
counter++;
RootAuthenticationSessionEntity entity = itr.next().getValue();
- tx.remove(CacheDecorators.localCache(cache), entity.getId());
+ tx.remove(cache, entity.getId());
}
log.debugf("Removed %d expired authentication sessions for realm '%s'", counter, realm.getName());
diff --git a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java
index c0b1aa0..709c417 100755
--- a/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java
+++ b/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java
@@ -476,8 +476,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
// Each cluster node cleanups just local sessions, which are those owned by itself (+ few more taking l1 cache into account)
Cache<String, SessionEntityWrapper<UserSessionEntity>> localCache = CacheDecorators.localCache(sessionCache);
- Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);
-
Cache<String, SessionEntityWrapper<UserSessionEntity>> localCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localCache);
final AtomicInteger userSessionsSize = new AtomicInteger();
@@ -495,12 +493,12 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
public void accept(UserSessionEntity userSessionEntity) {
userSessionsSize.incrementAndGet();
- Future future = localCache.removeAsync(userSessionEntity.getId());
+ Future future = sessionCache.removeAsync(userSessionEntity.getId());
futures.addTask(future);
userSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {
clientSessionsSize.incrementAndGet();
- Future f = localClientSessionCache.removeAsync(clientSessionId);
+ Future f = clientSessionCache.removeAsync(clientSessionId);
futures.addTask(f);
});
}
@@ -508,9 +506,10 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
});
// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate
- Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);
+ Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCache = CacheDecorators.localCache(clientSessionCache);
+ Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);
- localCacheStoreIgnoreClientSessionCache
+ localClientSessionCacheStoreIgnore
.entrySet()
.stream()
.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expired))
@@ -521,7 +520,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
public void accept(AuthenticatedClientSessionEntity clientSessionEntity) {
clientSessionsSize.incrementAndGet();
- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());
+ Future future = clientSessionCache.removeAsync(clientSessionEntity.getId());
futures.addTask(future);
}
@@ -539,7 +538,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
// Each cluster node cleanups just local sessions, which are those owned by himself (+ few more taking l1 cache into account)
Cache<String, SessionEntityWrapper<UserSessionEntity>> localCache = CacheDecorators.localCache(offlineSessionCache);
- Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);
UserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).expired(null, expiredOffline);
@@ -562,11 +560,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
public void accept(UserSessionEntity userSessionEntity) {
userSessionsSize.incrementAndGet();
- Future future = localCache.removeAsync(userSessionEntity.getId());
+ Future future = offlineSessionCache.removeAsync(userSessionEntity.getId());
futures.addTask(future);
userSessionEntity.getAuthenticatedClientSessions().forEach((clientUUID, clientSessionId) -> {
clientSessionsSize.incrementAndGet();
- Future f = localClientSessionCache.removeAsync(clientSessionId);
+ Future f = offlineClientSessionCache.removeAsync(clientSessionId);
futures.addTask(f);
});
@@ -575,11 +573,11 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
}
});
-
// Removing detached clientSessions. Ignore remoteStore for stream iteration. But we will invoke remoteStore for clientSession removal propagate
- Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localCacheStoreIgnoreClientSessionCache = CacheDecorators.localCache(localClientSessionCache);
+ Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCache = CacheDecorators.localCache(offlineClientSessionCache);
+ Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> localClientSessionCacheStoreIgnore = CacheDecorators.skipCacheLoaders(localClientSessionCache);
- localCacheStoreIgnoreClientSessionCache
+ localClientSessionCacheStoreIgnore
.entrySet()
.stream()
.filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expiredOffline))
@@ -590,7 +588,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
public void accept(AuthenticatedClientSessionEntity clientSessionEntity) {
clientSessionsSize.incrementAndGet();
- Future future = localClientSessionCache.removeAsync(clientSessionEntity.getId());
+ Future future = offlineClientSessionCache.removeAsync(clientSessionEntity.getId());
futures.addTask(future);
}