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 44c25ecf97..bcd5daf77c 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 @@ -865,7 +865,9 @@ public class InfinispanUserSessionProvider implements UserSessionProvider { offline ? SessionTimeouts::getOfflineSessionLifespanMs : SessionTimeouts::getUserSessionLifespanMs, offline ? SessionTimeouts::getOfflineSessionMaxIdleMs : SessionTimeouts::getUserSessionMaxIdleMs); } else { - cache.putAll(sessionsById); + Retry.executeWithBackoff((int iteration) -> { + cache.putAll(sessionsById); + }, 10, 10); } // put all entities to the remoteCache (if exists) @@ -899,15 +901,17 @@ public class InfinispanUserSessionProvider implements UserSessionProvider { } // Import client sessions - Cache> clientSessCache = offline ? offlineClientSessionCache : clientSessionCache; - clientSessCache = CacheDecorators.skipCacheLoaders(clientSessCache); + Cache> clientSessCache = + CacheDecorators.skipCacheLoaders(offline ? offlineClientSessionCache : clientSessionCache); if (importWithExpiration) { importSessionsWithExpiration(clientSessionsById, clientSessCache, offline ? SessionTimeouts::getOfflineClientSessionLifespanMs : SessionTimeouts::getClientSessionLifespanMs, offline ? SessionTimeouts::getOfflineClientSessionMaxIdleMs : SessionTimeouts::getClientSessionMaxIdleMs); } else { - clientSessCache.putAll(clientSessionsById); + Retry.executeWithBackoff((int iteration) -> { + clientSessCache.putAll(clientSessionsById); + }, 10, 10); } // put all entities to the remoteCache (if exists)