@Override public void handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) { delegate.handleFromRemoteSite(origin, command, reply, order); } }
@Override public void handleFromCluster(Address origin, ReplicableCommand command, Reply reply, DeliverOrder order) { if (command instanceof ClusteredGetCommand) { log.tracef("Blocking clustered get"); blocker.thenRun(() -> oldInvocationHandler.handleFromCluster(origin, command, reply, order)); } else { oldInvocationHandler.handleFromCluster(origin, command, reply, order); } }
@Override public void handleFromCluster(Address origin, ReplicableCommand command, Reply reply, DeliverOrder order) { if (command instanceof CacheTopologyControlCommand) { CacheTopologyControlCommand cmd = (CacheTopologyControlCommand) command; if (cmd.getType() == CacheTopologyControlCommand.Type.CH_UPDATE && cmd.getPhase() == READ_OLD_WRITE_ALL) awaitLatch(latch); } delegate.handleFromCluster(origin, command, reply, order); }
@Override public void handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) { oldInvocationHandler.handleFromRemoteSite(origin, command, reply, order); } };
private void assertDispatchForCommand(ReplicableCommand command, boolean expected) throws Exception { log.debugf("Testing " + command.getClass().getCanonicalName()); commandsFactory.initializeReplicableCommand(command, true); executorService.reset(); CompletableFutureResponse response = new CompletableFutureResponse(); invocationHandler.handleFromCluster(address, command, response, DeliverOrder.NONE); response.await(30, TimeUnit.SECONDS); Assert.assertEquals(executorService.hasExecutedCommand, expected, "Command " + command.getClass() + " dispatched wrongly."); executorService.reset(); response = new CompletableFutureResponse(); invocationHandler.handleFromCluster(address, command, response, DeliverOrder.PER_SENDER); response.await(30, TimeUnit.SECONDS); Assert.assertFalse(executorService.hasExecutedCommand, "Command " + command.getClass() + " dispatched wrongly."); }
@Override public void handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) { delegate.handleFromRemoteSite(origin, command, reply, order); } }
@Override public void handleFromCluster(Address origin, ReplicableCommand command, Reply reply, DeliverOrder order) { if (command instanceof CacheTopologyControlCommand) { try { checkPoint.trigger("blocked_" + index); checkPoint.awaitStrict("unblocked_" + index, 10, SECONDS); } catch (Exception e) { log.warnf(e, "Error while blocking before command %s", command); } } delegate.handleFromCluster(origin, command, reply, order); }
handler.handleFromRemoteSite("another-site", command, reply, DeliverOrder.PER_SENDER); assertEquals(1, (long) mBeanServer.getAttribute(objName, "SyncXSiteRequestsReceived")); assertEquals(0, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived")); handler.handleFromRemoteSite("another-site", command, reply, DeliverOrder.PER_SENDER); assertEquals(2, (long) mBeanServer.getAttribute(objName, "SyncXSiteRequestsReceived")); assertEquals(0, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived")); handler.handleFromRemoteSite("another-site", command, Reply.NO_OP, DeliverOrder.PER_SENDER); assertEquals(2, (long) mBeanServer.getAttribute(objName, "SyncXSiteRequestsReceived")); assertEquals(1, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived")); assertEquals(0, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived")); handler.handleFromRemoteSite("another-site", command, Reply.NO_OP, DeliverOrder.PER_SENDER); assertEquals(0, (long) mBeanServer.getAttribute(objName, "SyncXSiteRequestsReceived")); assertEquals(1, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived")); handler.handleFromRemoteSite("another-site", command, Reply.NO_OP, DeliverOrder.PER_SENDER); assertEquals(0, (long) mBeanServer.getAttribute(objName, "SyncXSiteRequestsReceived")); assertEquals(2, (long) mBeanServer.getAttribute(objName, "AsyncXSiteRequestsReceived"));