org.jboss.as.clustering.infinispan.cache.LazyCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-infinispan-extension Show documentation
Show all versions of wildfly-clustering-infinispan-extension Show documentation
Installs an extension that provides the infinispan subsystem.
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.jboss.as.clustering.infinispan.cache;
import java.lang.annotation.Annotation;
import java.util.Set;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import org.infinispan.AdvancedCache;
import org.infinispan.Cache;
import org.infinispan.CacheCollection;
import org.infinispan.CacheSet;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.notifications.cachelistener.filter.CacheEventConverter;
import org.infinispan.notifications.cachelistener.filter.CacheEventFilter;
/**
* An embedded cache that resolves itself from its cache container lazily.
* @author Paul Ferraro
*/
public class LazyCache extends LazyBasicCache> implements Cache {
private final EmbeddedCacheManager container;
private final String name;
public LazyCache(EmbeddedCacheManager container, String name) {
super(name);
this.container = container;
this.name = name;
}
@Override
public Cache run() {
return this.container.getCache(this.name);
}
@Override
public EmbeddedCacheManager getCacheManager() {
return this.container;
}
@Override
public AdvancedCache getAdvancedCache() {
return this.get().getAdvancedCache();
}
@Override
public Configuration getCacheConfiguration() {
return this.get().getCacheConfiguration();
}
@Deprecated
@Override
public Set