@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof StateResponseCommand) awaitLatch(latch); delegate.handle(command, reply, order); } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (!(command instanceof ClusteredGetCommand)) { delegate.handle(command, reply, order); } } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (!(command instanceof LockControlCommand)) { delegate.handle(command, reply, order); } } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { CountDownLatch latch = this.latch; if (command instanceof RenewBiasCommand && latch != null) { delegate.handle(command, response -> { reply.reply(response); this.latch = null; latch.countDown(); }, order); } else { delegate.handle(command, reply, order); } } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (discardRemoteGet && command.getCommandId() == ClusteredGetCommand.COMMAND_ID) { return; } delegate.handle(command, reply, order); } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof EndInvalidationCommand) { delegate.handle(command, response -> { latch.countDown(); log.tracef("Latch after count down %s", latch); reply.reply(response); }, order); } else { delegate.handle(command, reply, order); } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof StateResponseCommand) { StateResponseCommand stc = (StateResponseCommand) command; boolean isLastChunk = stc.getStateChunks().stream().anyMatch(StateChunk::isLastChunk); if (isLastChunk) { try { latch.await(60, TimeUnit.MILLISECONDS); } catch (InterruptedException ignore) { } } } delegate.handle(command, reply, order); } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof StateRequestCommand) { StateRequestCommand src = (StateRequestCommand) command; if (src.getSegments().contains(segment)) { future.complete(src); return; } } delegate.handle(command, reply, order); } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (!(command instanceof PrepareCommand)) { delegate.handle(command, reply, order); return; } try { prepareReceived.countDown(); prepareBlocked.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new IllegalLifecycleStateException(e); } log.trace("Processing belated prepare"); delegate.handle(command, returnValue -> { prepareExecuted.countDown(); reply.reply(returnValue); }, order); } };
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { final Filter currentFilter = filter; if (currentFilter != null && currentFilter.before(command, reply, order)) { delegate.handle(command, reply, order); } else { log.debugf("Ignoring command %s", command); } } }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { boolean accepted = matcher.accept(command); advance(accepted, statesBefore, reply); try { delegate.handle(command, reply, order); } finally { advance(accepted, statesAfter, Reply.NO_OP); } }
@Override public void handle(CacheRpcCommand cmd, Reply reply, DeliverOrder order) { boolean notifyRehashStarted = false; if (cmd instanceof CacheTopologyControlCommand) { CacheTopologyControlCommand rcc = (CacheTopologyControlCommand) cmd; log.debugf("Intercepted command: %s", cmd); switch (rcc.getType()) { case REBALANCE_START: try { txsReady.await(10, SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); reply.reply(new ExceptionResponse(e)); return; } notifyRehashStarted = true; break; case CH_UPDATE: // TODO Use another type instead, e.g. REBASE_END joinEnded.countDown(); break; } } delegate.handle(cmd, reply, order); if (notifyRehashStarted) rehashStarted.countDown(); } }
}).when(spyHandler).handle(any(CacheRpcCommand.class), any(Reply.class), any(DeliverOrder.class));
handler.handle(stateResponseCommand, Reply.NO_OP, DeliverOrder.PER_SENDER);