Class DefaultInfinispanConnectionProviderFactory

java.lang.Object
org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory
All Implemented Interfaces:
InfinispanConnectionProviderFactory, org.keycloak.provider.ProviderEventListener, org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>, org.keycloak.provider.ServerInfoAwareProviderFactory

public class DefaultInfinispanConnectionProviderFactory extends Object implements InfinispanConnectionProviderFactory, org.keycloak.provider.ProviderEventListener, org.keycloak.provider.ServerInfoAwareProviderFactory
Author:
Stian Thorgersen
  • Constructor Details

    • DefaultInfinispanConnectionProviderFactory

      public DefaultInfinispanConnectionProviderFactory()
  • Method Details

    • create

      public InfinispanConnectionProvider create(org.keycloak.models.KeycloakSession session)
      Specified by:
      create in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • runWithReadLockOnCacheManager

      public static void runWithReadLockOnCacheManager(Runnable task)
    • runWithWriteLockOnCacheManager

      public static void runWithWriteLockOnCacheManager(Runnable task)
    • close

      public void close()
      Specified by:
      close in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • getId

      public String getId()
      Specified by:
      getId in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • init

      public void init(org.keycloak.Config.Scope config)
      Specified by:
      init in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • postInit

      public void postInit(org.keycloak.models.KeycloakSessionFactory factory)
      Specified by:
      postInit in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • lazyInit

      protected InfinispanConnectionProvider lazyInit(org.keycloak.models.KeycloakSession keycloakSession)
    • createEmbeddedCacheManager

      protected org.infinispan.manager.EmbeddedCacheManager createEmbeddedCacheManager(org.keycloak.models.KeycloakSession session)
    • createRemoteCacheManager

      protected org.infinispan.client.hotrod.RemoteCacheManager createRemoteCacheManager(org.keycloak.models.KeycloakSession session)
    • initContainerManaged

      @Deprecated(since="26.0", forRemoval=true) protected org.infinispan.manager.EmbeddedCacheManager initContainerManaged(org.infinispan.manager.EmbeddedCacheManager cacheManager)
      Deprecated, for removal: This API element is subject to removal in a future version.
      not invoked anymore. Overwrite createEmbeddedCacheManager(KeycloakSession).
    • initEmbedded

      @Deprecated(since="26.3", forRemoval=true) protected org.infinispan.manager.EmbeddedCacheManager initEmbedded()
      Deprecated, for removal: This API element is subject to removal in a future version.
      not used anymore. Overwrite createEmbeddedCacheManager(KeycloakSession) if you want to create a custom EmbeddedCacheManager.
    • getKeysCacheConfig

      @Deprecated(since="26.3", forRemoval=true) protected org.infinispan.configuration.cache.Configuration getKeysCacheConfig()
      Deprecated, for removal: This API element is subject to removal in a future version.
      not used anymore
    • getCrlCacheConfig

      @Deprecated(since="26.3", forRemoval=true) protected org.infinispan.configuration.cache.Configuration getCrlCacheConfig()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • dependsOn

      public Set<Class<? extends org.keycloak.provider.Provider>> dependsOn()
      Specified by:
      dependsOn in interface org.keycloak.provider.ProviderFactory<InfinispanConnectionProvider>
    • onEvent

      public void onEvent(org.keycloak.provider.ProviderEvent event)
      Specified by:
      onEvent in interface org.keycloak.provider.ProviderEventListener
    • getOperationalInfo

      public Map<String,String> getOperationalInfo()
      Specified by:
      getOperationalInfo in interface org.keycloak.provider.ServerInfoAwareProviderFactory
    • isClusterHealthy

      public boolean isClusterHealthy()
      Description copied from interface: InfinispanConnectionProviderFactory
      Detects network split in the cluster.

      If a possible network split is detected and this node does not belong to the winning partition, this method will return false, and should not continue handling requests, to keep data safety.

      Specified by:
      isClusterHealthy in interface InfinispanConnectionProviderFactory
      Returns:
      true if the cluster is healthy and this node can continue processing requests. When false, this node must reject any work.
    • isClusterHealthSupported

      public boolean isClusterHealthSupported()
      Description copied from interface: InfinispanConnectionProviderFactory
      Checks if the cluster health check is supported.

      Not all JGroups configurations support discovering network splits and this method signals if the current in use configuration can detect those.

      Specified by:
      isClusterHealthSupported in interface InfinispanConnectionProviderFactory
      Returns:
      true if the cluster health check is supported.
    • isCoordinator

      public boolean isCoordinator()
      Description copied from interface: InfinispanConnectionProviderFactory
      Checks if the current node is the coordinator of the JGroups cluster.
      Specified by:
      isCoordinator in interface InfinispanConnectionProviderFactory
      Returns:
      true if this node is the coordinator.
    • isCoordinatorSupported

      public boolean isCoordinatorSupported()
      Description copied from interface: InfinispanConnectionProviderFactory
      Checks if the coordinator check is supported.

      Not all configurations use an embedded cache manager with JGroups clustering, so this method signals whether InfinispanConnectionProviderFactory.isCoordinator() returns meaningful results.

      Specified by:
      isCoordinatorSupported in interface InfinispanConnectionProviderFactory
      Returns:
      true if the coordinator check is supported.