use of org.infinispan.remoting.inboundhandler.InboundInvocationHandler in project infinispan by infinispan.
the class ConcurrentStartTest method replaceInboundInvocationHandler.
private void replaceInboundInvocationHandler(EmbeddedCacheManager cm, CheckPoint checkPoint, int index) {
InboundInvocationHandler handler = extractGlobalComponent(cm, InboundInvocationHandler.class);
BlockingInboundInvocationHandler ourHandler = new BlockingInboundInvocationHandler(handler, checkPoint, index);
replaceComponent(cm, InboundInvocationHandler.class, ourHandler, true);
}
use of org.infinispan.remoting.inboundhandler.InboundInvocationHandler in project infinispan by infinispan.
the class JGroupsTransportTest method blockRemoteGets.
private CompletableFuture<Void> blockRemoteGets() {
CompletableFuture<Void> blocker = new CompletableFuture<>();
InboundInvocationHandler oldInvocationHandler = TestingUtil.extractGlobalComponent(manager(1), InboundInvocationHandler.class);
InboundInvocationHandler blockingInvocationHandler = new InboundInvocationHandler() {
@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 handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) {
oldInvocationHandler.handleFromRemoteSite(origin, command, reply, order);
}
};
TestingUtil.replaceComponent(manager(1), InboundInvocationHandler.class, blockingInvocationHandler, true);
return blocker;
}
use of org.infinispan.remoting.inboundhandler.InboundInvocationHandler in project infinispan by infinispan.
the class OperationsDuringMergeConflictTest method performMerge.
@Override
protected void performMerge() {
boolean modifyDuringMerge = mergeAction != MergeAction.NONE;
CountDownLatch conflictLatch = new CountDownLatch(1);
CountDownLatch stateTransferLatch = new CountDownLatch(1);
try {
IntStream.range(0, numMembersInCluster).forEach(i -> {
wrapInboundInvocationHandler(cache(i), handler -> new BlockStateResponseCommandHandler(handler, conflictLatch));
EmbeddedCacheManager manager = manager(i);
InboundInvocationHandler handler = extractGlobalComponent(manager, InboundInvocationHandler.class);
BlockingInboundInvocationHandler ourHandler = new BlockingInboundInvocationHandler(handler, stateTransferLatch);
replaceComponent(manager, InboundInvocationHandler.class, ourHandler, true);
});
assertCacheGet(conflictKey, PARTITION_0_VAL, p0.getNodes());
assertCacheGet(conflictKey, PARTITION_1_VAL, p1.getNodes());
partition(0).merge(partition(1), false);
assertCacheGet(conflictKey, PARTITION_0_VAL, p0.getNodes());
assertCacheGet(conflictKey, PARTITION_1_VAL, p1.getNodes());
if (modifyDuringMerge) {
// Wait for CONFLICT_RESOLUTION topology to have been installed by the coordinator and then proceed
List<Address> allMembers = caches().stream().map(cache -> cache.getCacheManager().getAddress()).collect(Collectors.toList());
TestingUtil.waitForTopologyPhase(allMembers, CacheTopology.Phase.CONFLICT_RESOLUTION, caches().toArray(new Cache[numMembersInCluster]));
if (mergeAction == MergeAction.PUT) {
cache(0).put(conflictKey, mergeAction.value);
} else {
cache(0).remove(conflictKey);
}
}
conflictLatch.countDown();
stateTransferLatch.countDown();
TestingUtil.waitForNoRebalance(caches());
assertCacheGetValAllCaches(mergeAction);
} catch (Throwable t) {
conflictLatch.countDown();
stateTransferLatch.countDown();
throw t;
}
}
Aggregations