}
});
// Every ClusteredGetKeyValueCommand will be blocked before returning on cache0
CyclicBarrier beforeCache0Barrier = new CyclicBarrier(2);
BlockingInterceptor blockingInterceptor0 = new BlockingInterceptor(beforeCache0Barrier,
GetKeyValueCommand.class, false);
cache0.addInterceptorBefore(blockingInterceptor0, StateTransferInterceptor.class);
// Every PutKeyValueCommand will be blocked before returning on cache1
CyclicBarrier afterCache1Barrier = new CyclicBarrier(2);
BlockingInterceptor blockingInterceptor1 = new BlockingInterceptor(afterCache1Barrier,
op.getCommandClass(), false);
cache1.addInterceptorBefore(blockingInterceptor1, StateTransferInterceptor.class);
// Every PutKeyValueCommand will be blocked before reaching the distribution interceptor on cache2
CyclicBarrier beforeCache2Barrier = new CyclicBarrier(2);
BlockingInterceptor blockingInterceptor2 = new BlockingInterceptor(beforeCache2Barrier,
op.getCommandClass(), true);
cache2.addInterceptorBefore(blockingInterceptor2, NonTxDistributionInterceptor.class);
// Wait for cache1 to send the StateResponseCommand to cache1, but keep it blocked
// We only block the StateResponseCommand on cache1, because that's the node cache2 will ask for the magic key