Source:
public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) { AsyncInterceptorChain chain = cache.getAsyncInterceptorChain(); List<AsyncInterceptor> interceptors = chain.getInterceptors(); log.debug("Interceptor chain was: " + interceptors); int position = 0; int invalidationPosition = 0; int entryWrappingPosition = 0; for (AsyncInterceptor ci : interceptors) { if (ci instanceof InvalidationInterceptor) { invalidationPosition = position; } if (ci instanceof EntryWrappingInterceptor) { entryWrappingPosition = position; } position++; } boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); if (transactional) { cache.removeInterceptor(invalidationPosition); TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor(); cache.getComponentRegistry().registerComponent(txInvalidationInterceptor, TxInvalidationInterceptor.class); chain.addInterceptor(txInvalidationInterceptor, invalidationPosition); TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); cache.getComponentRegistry().registerComponent(txPutFromLoadInterceptor, TxPutFromLoadInterceptor.class); chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition); } else { cache.removeInterceptor(invalidationPosition); NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor(validator); cache.getComponentRegistry().registerComponent(nonTxInvalidationInterceptor, NonTxInvalidationInterceptor.class); chain.addInterceptor(nonTxInvalidationInterceptor, invalidationPosition); NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); cache.getComponentRegistry().registerComponent(nonTxPutFromLoadInterceptor, NonTxPutFromLoadInterceptor.class); chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition); validator.nonTxPutFromLoadInterceptor = nonTxPutFromLoadInterceptor; } log.debug("New interceptor chain is: " + cache.getAsyncInterceptorChain()); CacheCommandInitializer cacheCommandInitializer = cache.getComponentRegistry().getComponent(CacheCommandInitializer.class); cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator); }

Target:
public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) { AsyncInterceptorChain chain = cache.getAsyncInterceptorChain(); List<AsyncInterceptor> interceptors = chain.getInterceptors(); log.debugf("Interceptor chain was: ", interceptors); int position = 0; int invalidationPosition = 0; int entryWrappingPosition = 0; for (AsyncInterceptor ci : interceptors) { if (ci instanceof InvalidationInterceptor) { invalidationPosition = position; } if (ci instanceof EntryWrappingInterceptor) { entryWrappingPosition = position; } position++; } boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); if (transactional) { cache.removeInterceptor(invalidationPosition); TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor(); cache.getComponentRegistry().registerComponent(txInvalidationInterceptor, TxInvalidationInterceptor.class); chain.addInterceptor(txInvalidationInterceptor, invalidationPosition); TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); cache.getComponentRegistry().registerComponent(txPutFromLoadInterceptor, TxPutFromLoadInterceptor.class); chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition); } else { cache.removeInterceptor(invalidationPosition); NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor(validator); cache.getComponentRegistry().registerComponent(nonTxInvalidationInterceptor, NonTxInvalidationInterceptor.class); chain.addInterceptor(nonTxInvalidationInterceptor, invalidationPosition); NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName())); cache.getComponentRegistry().registerComponent(nonTxPutFromLoadInterceptor, NonTxPutFromLoadInterceptor.class); chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition); validator.nonTxPutFromLoadInterceptor = nonTxPutFromLoadInterceptor; } log.debugf("New interceptor chain is: ", cache.getAsyncInterceptorChain()); CacheCommandInitializer cacheCommandInitializer = cache.getComponentRegistry().getComponent(CacheCommandInitializer.class); cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator); }