@Override protected final void resetCaches(List<Cache<GroupKey, String>> cacheList) { for (Cache cache : cacheList) { InterceptorChain chain = TestingUtil.extractComponent(cache, InterceptorChain.class); if (chain.containsInterceptorType(BlockCommandInterceptor.class)) { ((BlockCommandInterceptor) chain.getInterceptorsWithClass(BlockCommandInterceptor.class).get(0)) .reset(); } } }
private static BlockCommandInterceptor injectBlockCommandInterceptorIfAbsent( Cache<GroupKey, String> cache) { InterceptorChain chain = TestingUtil.extractComponent(cache, InterceptorChain.class); BlockCommandInterceptor interceptor; if (chain.containsInterceptorType(BlockCommandInterceptor.class)) { interceptor = (BlockCommandInterceptor) chain.getInterceptorsWithClass(BlockCommandInterceptor.class).get(0); } else { interceptor = new BlockCommandInterceptor(); chain.addInterceptorAfter(interceptor, EntryWrappingInterceptor.class); } interceptor.reset(); return interceptor; }