Source:
public void testOneOwnerSuspectedNoFilter(Method m) throws ExecutionException, InterruptedException { initAndCheck(m); CountDownLatch arrival = new CountDownLatch(2); CountDownLatch release1 = new CountDownLatch(1); CountDownLatch release2 = new CountDownLatch(1); cache(1).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release1), 0); cache(2).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release2), 0); Address address1 = address(1); Address address2 = address(2); List<Address> owners = Arrays.asList(address1, address2); ClusteredGetCommand clusteredGet = new ClusteredGetCommand(key, ByteString.fromString(cache(0).getName()), 0, AnyEquivalence.getInstance()); final int timeout = 15; RpcOptions rpcOptions = new RpcOptions(timeout, TimeUnit.SECONDS, null, ResponseMode.WAIT_FOR_VALID_RESPONSE, DeliverOrder.NONE); RpcManager rpcManager = cache(0).getAdvancedCache().getRpcManager(); CompletableFuture<Map<Address, Response>> future = rpcManager.invokeRemotelyAsync(owners, clusteredGet, rpcOptions); assertTrue(arrival.await(10, TimeUnit.SECONDS)); installNewView(cache(0), cache(0), cache(1)); Thread.sleep(100); assertFalse(future.isDone()); long requestAllowed = System.nanoTime(); release1.countDown(); Map<Address, Response> responses = future.get(); long requestCompleted = System.nanoTime(); assertEquals(0, TimeUnit.NANOSECONDS.toSeconds(requestCompleted - requestAllowed), timeout); assertEquals(SuccessfulResponse.create(new ImmortalCacheValue(m.getName())), responses.get(address1)); assertEquals(CacheNotFoundResponse.INSTANCE, responses.get(address2)); release2.countDown(); }

Target:
public void testOneOwnerSuspectedNoFilter(Method m) throws ExecutionException, InterruptedException { initAndCheck(m); CountDownLatch arrival = new CountDownLatch(2); CountDownLatch release1 = new CountDownLatch(1); CountDownLatch release2 = new CountDownLatch(1); cache(1).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release1), 0); cache(2).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release2), 0); Address address1 = address(1); Address address2 = address(2); List<Address> owners = Arrays.asList(address1, address2); ClusteredGetCommand clusteredGet = new ClusteredGetCommand(key, ByteString.fromString(cache(0).getName()), 0, AnyEquivalence.getInstance()); final int timeout = 15; RpcOptions rpcOptions = new RpcOptions(timeout, TimeUnit.SECONDS, null, ResponseMode.WAIT_FOR_VALID_RESPONSE, DeliverOrder.NONE); RpcManager rpcManager = cache(0).getAdvancedCache().getRpcManager(); CompletableFuture<Map<Address, Response>> future = rpcManager.invokeRemotelyAsync(owners, clusteredGet, rpcOptions); assertTrue(arrival.await(10, TimeUnit.SECONDS)); installNewView(cache(0), cache(0), cache(1)); Thread.sleep(100); assertFalse(future.isDone()); long requestAllowed = System.nanoTime(); release1.countDown(); Map<Address, Response> responses = future.get(); long requestCompleted = System.nanoTime(); long requestSeconds = TimeUnit.NANOSECONDS.toSeconds(requestCompleted - requestAllowed); assertTrue("Request took too long: " + requestSeconds, requestSeconds < timeout / 2); assertEquals(SuccessfulResponse.create(new ImmortalCacheValue(m.getName())), responses.get(address1)); assertEquals(CacheNotFoundResponse.INSTANCE, responses.get(address2)); release2.countDown(); }