private void createRemoteValueWrapperInterceptor(ComponentRegistry cr, Configuration cfg) { RemoteValueWrapperInterceptor wrapperInterceptor = cr.getComponent(RemoteValueWrapperInterceptor.class); if (wrapperInterceptor == null) { wrapperInterceptor = new RemoteValueWrapperInterceptor(); // Interceptor registration not needed, core configuration handling // already does it for all custom interceptors - UNLESS the InterceptorChain already exists in // the component registry! AsyncInterceptorChain ic = cr.getComponent(AsyncInterceptorChain.class); ConfigurationBuilder builder = new ConfigurationBuilder().read(cfg); InterceptorConfigurationBuilder interceptorBuilder = builder.customInterceptors().addInterceptor(); interceptorBuilder.interceptor(wrapperInterceptor); if (cfg.invocationBatching().enabled()) { if (ic != null) ic.addInterceptorAfter(wrapperInterceptor, BatchingInterceptor.class); interceptorBuilder.after(BatchingInterceptor.class); } else { if (ic != null) ic.addInterceptorAfter(wrapperInterceptor, InvocationContextInterceptor.class); interceptorBuilder.after(InvocationContextInterceptor.class); } if (ic != null) { cr.registerComponent(wrapperInterceptor, RemoteValueWrapperInterceptor.class); } cfg.customInterceptors().interceptors(builder.build().customInterceptors().interceptors()); } }
protected PrepareCommandBlocker addPrepareBlockerIfAbsent(Cache<?, ?> cache) { AsyncInterceptorChain chain = cache.getAdvancedCache().getAsyncInterceptorChain(); PrepareCommandBlocker blocker = chain.findInterceptorWithClass(PrepareCommandBlocker.class); if (blocker != null) return blocker; blocker = new PrepareCommandBlocker(); chain.addInterceptorBefore(blocker, TxInterceptor.class); return blocker; }
protected CacheUsageInterceptor getTopKey(Cache<?, ?> cache) { AsyncInterceptorChain interceptorChain = cache.getAdvancedCache().getAsyncInterceptorChain(); return interceptorChain.findInterceptorExtending(CacheUsageInterceptor.class); }
private boolean verifyChainContainsRemoteValueWrapperInterceptor(ComponentRegistry cr) { AsyncInterceptorChain interceptorChain = cr.getComponent(AsyncInterceptorChain.class); return interceptorChain != null && interceptorChain.containsInterceptorType(RemoteValueWrapperInterceptor.class, true); }