org.infinispan.cache.impl.AbstractDelegatingAdvancedCache Maven / Gradle / Ivy
package org.infinispan.cache.impl;
import org.infinispan.AdvancedCache;
import org.infinispan.atomic.Delta;
import org.infinispan.batch.BatchContainer;
import org.infinispan.commons.util.concurrent.NotifyingFuture;
import org.infinispan.container.DataContainer;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.Flag;
import org.infinispan.context.InvocationContextContainer;
import org.infinispan.distribution.DistributionManager;
import org.infinispan.eviction.EvictionManager;
import org.infinispan.factories.ComponentRegistry;
import org.infinispan.filter.KeyValueFilter;
import org.infinispan.interceptors.base.CommandInterceptor;
import org.infinispan.iteration.EntryIterable;
import org.infinispan.metadata.Metadata;
import org.infinispan.partitionhandling.AvailabilityMode;
import org.infinispan.remoting.rpc.RpcManager;
import org.infinispan.security.AuthorizationManager;
import org.infinispan.stats.Stats;
import org.infinispan.util.concurrent.locks.LockManager;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
/**
* Similar to {@link org.infinispan.cache.impl.AbstractDelegatingCache}, but for {@link AdvancedCache}.
*
* @author [email protected]
* @author Tristan Tarrant
* @see org.infinispan.cache.impl.AbstractDelegatingCache
*/
public class AbstractDelegatingAdvancedCache extends AbstractDelegatingCache implements AdvancedCache {
protected final AdvancedCache cache;
private final AdvancedCacheWrapper wrapper;
public AbstractDelegatingAdvancedCache(final AdvancedCache cache) {
this(cache, new AdvancedCacheWrapper() {
@Override
public AdvancedCache wrap(AdvancedCache cache) {
return new AbstractDelegatingAdvancedCache(cache);
}
});
}
public AbstractDelegatingAdvancedCache(
AdvancedCache cache, AdvancedCacheWrapper wrapper) {
super(cache);
this.cache = cache;
this.wrapper = wrapper;
}
@Override
public void addInterceptor(CommandInterceptor i, int position) {
cache.addInterceptor(i, position);
}
@Override
public boolean addInterceptorAfter(CommandInterceptor i, Class extends CommandInterceptor> afterInterceptor) {
return cache.addInterceptorAfter(i, afterInterceptor);
}
@Override
public boolean addInterceptorBefore(CommandInterceptor i, Class extends CommandInterceptor> beforeInterceptor) {
return cache.addInterceptorBefore(i, beforeInterceptor);
}
@Override
public void removeInterceptor(int position) {
cache.removeInterceptor(position);
}
@Override
public void removeInterceptor(Class extends CommandInterceptor> interceptorType) {
cache.removeInterceptor(interceptorType);
}
@Override
public AdvancedCache getAdvancedCache() {
//We need to override the super implementation which returns to the decorated cache;
//otherwise the current operation breaks out of the selected ClassLoader.
return this;
}
@Override
public List getInterceptorChain() {
return cache.getInterceptorChain();
}
@Override
public EvictionManager getEvictionManager() {
return cache.getEvictionManager();
}
@Override
public ComponentRegistry getComponentRegistry() {
return cache.getComponentRegistry();
}
@Override
public DistributionManager getDistributionManager() {
return cache.getDistributionManager();
}
@Override
public AuthorizationManager getAuthorizationManager() {
return cache.getAuthorizationManager();
}
@Override
public RpcManager getRpcManager() {
return cache.getRpcManager();
}
@Override
public BatchContainer getBatchContainer() {
return cache.getBatchContainer();
}
@Override
public InvocationContextContainer getInvocationContextContainer() {
return cache.getInvocationContextContainer();
}
@Override
public DataContainer getDataContainer() {
return cache.getDataContainer();
}
@Override
public TransactionManager getTransactionManager() {
return cache.getTransactionManager();
}
@Override
public LockManager getLockManager() {
return cache.getLockManager();
}
@Override
public XAResource getXAResource() {
return cache.getXAResource();
}
@Override
public AvailabilityMode getAvailability() {
return cache.getAvailability();
}
@Override
public void setAvailability(AvailabilityMode availabilityMode) {
cache.setAvailability(availabilityMode);
}
@Override
public AdvancedCache withFlags(Flag... flags) {
return this.wrapper.wrap(this.cache.withFlags(flags));
}
@Override
public boolean lock(K... key) {
return cache.lock(key);
}
@Override
public boolean lock(Collection extends K> keys) {
return cache.lock(keys);
}
@Override
public void applyDelta(K deltaAwareValueKey, Delta delta, Object... locksToAcquire){
cache.applyDelta(deltaAwareValueKey, delta, locksToAcquire);
}
@Override
public Stats getStats() {
return cache.getStats();
}
@Override
public ClassLoader getClassLoader() {
return cache.getClassLoader();
}
@Override
public AdvancedCache with(ClassLoader classLoader) {
return this.wrapper.wrap(this.cache.with(classLoader));
}
@Override
public CacheEntry getCacheEntry(K key) {
return cache.getCacheEntry(key);
}
@Override
public EntryIterable filterEntries(KeyValueFilter super K, ? super V> filter) {
return cache.filterEntries(filter);
}
@Override
public java.util.Map getGroup(String groupName) {
return cache.getGroup(groupName);
}
@Override
public void removeGroup(String groupName) {
cache.removeGroup(groupName);
}
@Override
public V put(K key, V value, Metadata metadata) {
return cache.put(key, value, metadata);
}
@Override
public V replace(K key, V value, Metadata metadata) {
return cache.replace(key, value, metadata);
}
@Override
public boolean replace(K key, V oldValue, V value, Metadata metadata) {
return cache.replace(key, oldValue, value, metadata);
}
@Override
public V putIfAbsent(K key, V value, Metadata metadata) {
return cache.putIfAbsent(key, value, metadata);
}
@Override
public NotifyingFuture putAsync(K key, V value, Metadata metadata) {
return cache.putAsync(key, value, metadata);
}
@Override
public void putForExternalRead(K key, V value, Metadata metadata) {
cache.putForExternalRead(key, value, metadata);
}
protected final void putForExternalRead(K key, V value, EnumSet flags, ClassLoader classLoader) {
((CacheImpl) cache).putForExternalRead(key, value, flags, classLoader);
}
protected final void putForExternalRead(K key, V value, Metadata metadata, EnumSet flags, ClassLoader classLoader) {
((CacheImpl) cache).putForExternalRead(key, value, metadata, flags, classLoader);
}
public interface AdvancedCacheWrapper {
AdvancedCache wrap(AdvancedCache cache);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy