All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.interceptors.base.BaseCustomInterceptor Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.interceptors.base;

import org.infinispan.Cache;
import org.infinispan.factories.annotations.Inject;
import org.infinispan.factories.annotations.Start;
import org.infinispan.factories.annotations.Stop;
import org.infinispan.interceptors.BaseCustomAsyncInterceptor;
import org.infinispan.manager.EmbeddedCacheManager;

/**
 * Anyone using the {@link org.infinispan.AdvancedCache#addInterceptor(CommandInterceptor, int)} method (or any of its
 * overloaded forms) or registering custom interceptors via XML should extend this base class when creating their own
 * custom interceptors.
 * 

* As of Infinispan 5.1, annotations on custom interceptors, including {@link Inject}, {@link Start} and {@link Stop} * will not be respected and callbacks will not be made. *

* Instead, custom interceptor authors should extend this base class to gain access to {@link Cache} and {@link EmbeddedCacheManager}, * from which other components may be accessed. Further, lifecycle should be implemented by overriding {@link #start()} * and {@link #stop()} as defined in this class. * * @author Manik Surtani * @deprecated Since 9.0, use {@link BaseCustomAsyncInterceptor} instead. */ @Deprecated public class BaseCustomInterceptor extends CommandInterceptor { protected Cache cache; protected EmbeddedCacheManager embeddedCacheManager; @Inject private void setup(Cache cache, EmbeddedCacheManager embeddedCacheManager) { if (this.cache != null && this.cache != cache) { // see https://issues.jboss.org/browse/ISPN-5335 throw new IllegalStateException("Setting up the interceptor second time;" + "this could be caused by the same instance of interceptor used by several caches."); } this.cache = cache; this.embeddedCacheManager = embeddedCacheManager; } @Start protected void start() { // Meant to be overridden } @Stop protected void stop() { // Meant to be overridden } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy