parent
a10d511b12
commit
c2c5012cfb
4 changed files with 11 additions and 12 deletions
|
@ -18,7 +18,6 @@
|
|||
package org.keycloak.models.sessions.infinispan.initializer;
|
||||
|
||||
import org.infinispan.Cache;
|
||||
import org.infinispan.commons.CacheConfigurationException;
|
||||
import org.infinispan.commons.CacheException;
|
||||
import org.infinispan.factories.ComponentRegistry;
|
||||
import org.infinispan.manager.ClusterExecutor;
|
||||
|
@ -63,12 +62,12 @@ public class InfinispanCacheInitializer extends BaseCacheInitializer {
|
|||
|
||||
@Override
|
||||
public void initCache() {
|
||||
final ComponentRegistry cr = this.workCache.getAdvancedCache().getComponentRegistry();
|
||||
try {
|
||||
cr.registerComponent(sessionFactory, KeycloakSessionFactory.class);
|
||||
} catch (UnsupportedOperationException | CacheConfigurationException ex) {
|
||||
// due to lazy initialization, this might be called from multiple threads simultaneously, therefore, synchronize
|
||||
synchronized (workCache) {
|
||||
final ComponentRegistry cr = this.workCache.getAdvancedCache().getComponentRegistry();
|
||||
// first check if already set, as Infinispan would otherwise throw a RuntimeException
|
||||
if (cr.getComponent(KeycloakSessionFactory.class) != sessionFactory) {
|
||||
throw ex;
|
||||
cr.registerComponent(sessionFactory, KeycloakSessionFactory.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -81,8 +81,8 @@
|
|||
<jakarta.persistence.version>2.2.3</jakarta.persistence.version>
|
||||
<hibernate-orm.version>6.2.1.Final</hibernate-orm.version>
|
||||
<hibernate.c3p0.version>${hibernate-orm.version}</hibernate.c3p0.version>
|
||||
<infinispan.version>14.0.7.Final</infinispan.version>
|
||||
<infinispan.protostream.processor.version>4.6.0.Final</infinispan.protostream.processor.version>
|
||||
<infinispan.version>14.0.8.Final</infinispan.version>
|
||||
<infinispan.protostream.processor.version>4.6.2.Final</infinispan.protostream.processor.version>
|
||||
<jackson.version>2.14.2</jackson.version>
|
||||
<jackson.databind.version>2.14.2</jackson.databind.version>
|
||||
<jackson.annotations.version>${jackson.version}</jackson.annotations.version>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
<infinispan
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:infinispan:config:11.0 http://www.infinispan.org/schemas/infinispan-config-11.0.xsd"
|
||||
xmlns="urn:infinispan:config:11.0">
|
||||
xsi:schemaLocation="urn:infinispan:config:14.0 http://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
|
||||
xmlns="urn:infinispan:config:14.0">
|
||||
|
||||
<cache-container name="keycloak">
|
||||
<transport lock-timeout="60000"/>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
<infinispan
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:infinispan:config:11.0 http://www.infinispan.org/schemas/infinispan-config-11.0.xsd"
|
||||
xmlns="urn:infinispan:config:11.0">
|
||||
xsi:schemaLocation="urn:infinispan:config:14.0 http://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
|
||||
xmlns="urn:infinispan:config:14.0">
|
||||
|
||||
<cache-container name="keycloak">
|
||||
<local-cache name="default">
|
||||
|
|
Loading…
Reference in a new issue