Non clustered Keycloak with External Infinispan feature

Disables JGroups (clustering) when remote-cache feature is enabled

Fixes #31876

Signed-off-by: Pedro Ruivo <pruivo@redhat.com>
This commit is contained in:
Pedro Ruivo 2024-08-02 21:24:24 +01:00 committed by Alexander Schwartz
parent 62fd969fe1
commit 1e9f6bbb8c
2 changed files with 10 additions and 0 deletions

View file

@ -286,6 +286,13 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
}
Marshalling.configure(gcb);
if (InfinispanUtils.isRemoteInfinispan()) {
// Disable JGroups, not required when the data is stored in the Remote Cache.
// The existing caches are local and do not require JGroups to work properly.
gcb.nonClusteredDefault();
}
EmbeddedCacheManager cacheManager = new DefaultCacheManager(gcb.build());
if (useKeycloakTimeService) {
setTimeServiceToKeycloakTime(cacheManager);

View file

@ -347,6 +347,9 @@ public class CacheManagerFactory {
logger.warnf("remote-store configuration detected for cache '%s'. Explicit cache configuration ignored when using '%s' Feature", cacheName, Profile.Feature.REMOTE_CACHE.getKey());
builders.remove(cacheName);
}
// Disable JGroups, not required when the data is stored in the Remote Cache.
// The existing caches are local and do not require JGroups to work properly.
builder.getGlobalConfigurationBuilder().nonClusteredDefault();
}
var start = isStartEagerly();