Refine search
static <T extends AsyncInterceptor> T findInterceptor(Cache<?, ?> cache, Class<T> interceptorClass) { return cache.getAdvancedCache().getAsyncInterceptorChain().findInterceptorExtending(interceptorClass); } }
static <T extends AsyncInterceptor> T findInterceptor(Cache<?, ?> cache, Class<T> interceptorClass) { return cache.getAdvancedCache().getAsyncInterceptorChain().findInterceptorExtending(interceptorClass); } }
public static <T extends AsyncInterceptor> T findInterceptor(Cache<?, ?> cache, Class<T> interceptorToFind) { return cache.getAdvancedCache().getAsyncInterceptorChain() .findInterceptorExtending(interceptorToFind); }
private ExceptionTrackerInterceptor getInterceptor(Cache cache) { return cache.getAdvancedCache().getAsyncInterceptorChain() .findInterceptorWithClass(ExceptionTrackerInterceptor.class); }
public AfterEntryWrappingInterceptor injectThis(Cache<Object, Object> injectInCache) { injectInCache.getAdvancedCache().getAsyncInterceptorChain().addInterceptorAfter(this, EntryWrappingInterceptor.class); return this; }
private void initOurInterceptor() { if (ourInterceptor == null) { ourInterceptor = SequencerInterceptor.createUniqueInterceptor(cache.getAdvancedCache().getAsyncInterceptorChain()); ourInterceptor.init(stateSequencer, matcher); cache.getAdvancedCache().getAsyncInterceptorChain().addInterceptorBefore(ourInterceptor, interceptorClass); } }
@Override protected final void resetCaches(List<Cache<BaseUtilGroupTest.GroupKey, String>> cacheList) { for (Cache cache : cacheList) { AsyncInterceptorChain chain = cache.getAdvancedCache().getAsyncInterceptorChain(); BlockCommandInterceptor interceptor = chain.findInterceptorExtending(BlockCommandInterceptor.class); if (interceptor != null) { interceptor.reset(); } } }
@Override protected final void resetCaches(List<Cache<GroupKey, String>> cacheList) { for (Cache cache : cacheList) { AsyncInterceptorChain chain = cache.getAdvancedCache().getAsyncInterceptorChain(); BlockCommandInterceptor interceptor = chain.findInterceptorWithClass(BlockCommandInterceptor.class); if (interceptor != null) { interceptor.reset(); } } }
@AfterMethod public void dropFailPrepare() { cache(0).getAdvancedCache().getAsyncInterceptorChain().removeInterceptor(FailPrepare.class); }
@Override public void call() { List<AsyncInterceptor> interceptors = cacheManager.getCache("interceptors").getAdvancedCache().getAsyncInterceptorChain() .getInterceptors(); assertEquals(FooInterceptor.class, interceptors.get(interceptors.size() - 2).getClass()); } });
private void assertQueryInterceptorPresent(Cache<?, ?> c) { QueryInterceptor i = TestingUtil.findInterceptor(c, QueryInterceptor.class); assert i != null : "Expected to find a QueryInterceptor, only found " + c.getAdvancedCache().getAsyncInterceptorChain().getInterceptors(); }
@Override protected void createCacheManagers() throws Throwable { super.createCacheManagers(); countingRequestRepositories = cacheManagers.stream().map(cm -> CountingRequestRepository.replaceDispatcher(cm)).collect(Collectors.toList()); Stream.of(null, DIST, REPL, SCATTERED).forEach(name -> caches(name).forEach(c -> { c.getAdvancedCache().getAsyncInterceptorChain().addInterceptorBefore(new CommandCachingInterceptor(), CallInterceptor.class); })); }
@Override public void call() { AsyncInterceptorChain interceptorChain = cacheManager.getCache("interceptors").getAdvancedCache().getAsyncInterceptorChain(); assertEquals(interceptorChain.getInterceptors().get(1).getClass(), FooInterceptor.class); } });
public AfterActivationOrCacheLoader injectThis(Cache<Object, Object> injectInCache) { AsyncInterceptorChain chain = TestingUtil.extractComponent(injectInCache, AsyncInterceptorChain.class); AsyncInterceptor loaderInterceptor = chain.findInterceptorExtending(org.infinispan.interceptors.impl.CacheLoaderInterceptor.class); injectInCache.getAdvancedCache().getAsyncInterceptorChain().addInterceptorAfter(this, loaderInterceptor.getClass()); return this; }
private SkipIndexingFlagCheckCommandInterceptor init() { Iterator<CommandInterceptor> iterator = cacheManager.getCache(cacheName).getAdvancedCache().getInterceptorChain().iterator(); while (iterator.hasNext()) { CommandInterceptor commandInterceptor = iterator.next(); if (commandInterceptor instanceof SkipIndexingFlagCheckCommandInterceptor) return (SkipIndexingFlagCheckCommandInterceptor) commandInterceptor; } SkipIndexingFlagCheckCommandInterceptor ci = new SkipIndexingFlagCheckCommandInterceptor(); cacheManager.getCache(cacheName).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(ci, 1); return ci; }
private void printCacheStats(PrintWriter pw, Cache<?, ?> cache) throws StatementException { if (!cache.getCacheConfiguration().jmxStatistics().enabled()) { throw log.statisticsNotEnabled(cache.getName()); } for (AsyncInterceptor interceptor : cache.getAdvancedCache().getAsyncInterceptorChain().getInterceptors()) { printComponentStats(pw, cache, interceptor); } printComponentStats(pw, cache, cache.getAdvancedCache().getLockManager()); printComponentStats(pw, cache, cache.getAdvancedCache().getRpcManager()); }
public void testBaseCustomAsyncInterceptorInjection() { AsyncInterceptor interceptor = cache.getAdvancedCache().getAsyncInterceptorChain().getInterceptors().get(0); assertEquals(SomeAsyncInterceptor.class, interceptor.getClass()); SomeAsyncInterceptor someAsyncInterceptor = (SomeAsyncInterceptor) interceptor; assertSame(cache.getAdvancedCache().getLockManager(), someAsyncInterceptor.lm); assertSame(cache.getAdvancedCache().getDataContainer(), someAsyncInterceptor.dc); }
protected BlockingInterceptor addBlockingInterceptor(Cache<?, ?> cache, final CyclicBarrier barrier, Class<? extends VisitableCommand> commandClass, Class<? extends AsyncInterceptor> interceptorPosition, boolean blockAfterCommand) { BlockingInterceptor bi = new BlockingInterceptor<>(barrier, commandClass, blockAfterCommand, false); AsyncInterceptorChain interceptorChain = cache.getAdvancedCache().getAsyncInterceptorChain(); assertTrue(interceptorChain.addInterceptorBefore(bi, interceptorPosition)); return bi; }
protected static void removeAllBlockingInterceptorsFromCache(Cache<?, ?> cache) { AsyncInterceptorChain chain = cache.getAdvancedCache().getAsyncInterceptorChain(); BlockingInterceptor blockingInterceptor = chain.findInterceptorExtending(BlockingInterceptor.class); while (blockingInterceptor != null) { blockingInterceptor.suspend(true); chain.removeInterceptor(blockingInterceptor.getClass()); blockingInterceptor = chain.findInterceptorExtending(BlockingInterceptor.class); } }
public void testNoTxInterceptor() { final AsyncInterceptorChain interceptorChain = cache.getAdvancedCache().getAsyncInterceptorChain(); log.trace(interceptorChain); assertFalse(interceptorChain.containsInterceptorType(TxInterceptor.class)); } }