Search in sources :

Example 1 with CacheManagerFactory

use of org.keycloak.quarkus.runtime.storage.infinispan.CacheManagerFactory in project keycloak by keycloak.

the class KeycloakRecorder method createCacheInitializer.

public RuntimeValue<CacheManagerFactory> createCacheInitializer(String config, ShutdownContext shutdownContext) {
    try {
        CacheManagerFactory cacheManagerFactory = new CacheManagerFactory(config);
        shutdownContext.addShutdownTask(new Runnable() {

            @Override
            public void run() {
                DefaultCacheManager cacheManager = cacheManagerFactory.getOrCreate();
                if (cacheManager != null) {
                    cacheManager.stop();
                }
            }
        });
        return new RuntimeValue<>(cacheManagerFactory);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) RuntimeValue(io.quarkus.runtime.RuntimeValue) CacheManagerFactory(org.keycloak.quarkus.runtime.storage.infinispan.CacheManagerFactory)

Aggregations

RuntimeValue (io.quarkus.runtime.RuntimeValue)1 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)1 CacheManagerFactory (org.keycloak.quarkus.runtime.storage.infinispan.CacheManagerFactory)1