Jiří Holuša created ISPN-6496:
---------------------------------
Summary: Custom interceptor's start method not called if interceptor
added via AdvancedCache
Key: ISPN-6496
URL:
https://issues.jboss.org/browse/ISPN-6496
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 8.1.2.Final
Reporter: Jiří Holuša
Suppose I want to add trivial custom interceptor like this:
{code}
public class LocalIndexInterceptor extends BaseCustomInterceptor {
@Override
protected void start() {
System.out.println("Start method executed");
}
// override some command methods here
}
{code}
When I attach the interceptor via:
{code}
cache.getAdvancedCache().addInterceptor(new LocalIndexInterceptor(), 0);
{code}
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 :) ).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)