-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
8.1.2.Final
-
None
Suppose I want to add trivial custom interceptor like this:
public class LocalIndexInterceptor extends BaseCustomInterceptor { @Override protected void start() { System.out.println("Start method executed"); } // override some command methods here }
When I attach the interceptor via:
cache.getAdvancedCache().addInterceptor(new LocalIndexInterceptor(), 0);
the start method never gets called and nothing is printed. When I add the interceptor during the cache configuration (via ConfigurationBuilder.customInterceptor().addInterceptor().interceptor()), everything works fine and the start method is executed.
I noticed at the @Start annotation Javadoc: "Method level annotation that indicates a (no-param) method to be called on a component registered in the ComponentRegistry when the cache starts.", so I get it that it's not executed since the cache is already started. However, without the start() method being executed, I cannot access cache additional object (DistributionManager, RpcManager) in the interceptor, which might be needed (and I needed it ).