@Override public void handle( CacheRpcCommand cmd, Address origin, org.jgroups.blocks.Response response, boolean preserveOrder) throws Throwable { boolean notifyRehashStarted = false; if (cmd instanceof CacheTopologyControlCommand) { CacheTopologyControlCommand rcc = (CacheTopologyControlCommand) cmd; log.debugf("Intercepted command: %s", cmd); switch (rcc.getType()) { case REBALANCE_START: txsReady.await(); notifyRehashStarted = true; break; case CH_UPDATE: // TODO Use another type instead, e.g. REBASE_END joinEnded.countDown(); break; } } delegate.handle(cmd, origin, response, preserveOrder); if (notifyRehashStarted) rehashStarted.countDown(); }
private Object executeCommand(ReplicableCommand cmd, Message req) throws Throwable { if (cmd == null) throw new NullPointerException("Unable to execute a null command! Message was " + req); if (cmd instanceof CacheRpcCommand) { if (trace) log.tracef("Attempting to execute command: %s [sender=%s]", cmd, req.getSrc()); return inboundInvocationHandler.handle( (CacheRpcCommand) cmd, fromJGroupsAddress(req.getSrc())); } else { if (trace) log.tracef( "Attempting to execute non-CacheRpcCommand command: %s [sender=%s]", cmd, req.getSrc()); return cmd.perform(null); } }