protected List<Address> getMembers() { return distributionManager.getCacheTopology().getMembers(); }
public void assertConsistentHashMembers(List<org.infinispan.remoting.transport.Address> expectedMembers) { for (Cache c : cachesInThisPartition()) { assertEquals(new HashSet<>(c.getAdvancedCache().getDistributionManager().getCacheTopology().getMembers()), new HashSet<>(expectedMembers)); } }
private int topologySize(Cache cache) { return cache.getAdvancedCache().getDistributionManager().getCacheTopology().getMembers().size(); } }
protected Object endInvalidationAndInvokeNextInterceptor(TxInvocationContext<?> ctx, VisitableCommand command) throws Throwable { try { if (ctx.isOriginLocal()) { // We cannot use directly ctx.getAffectedKeys() and that includes keys from local-only operations. // During evictAll inside transaction this would cause unnecessary invalidate command if (!ctx.getModifications().isEmpty()) { Object[] keys = ctx.getModifications().stream() .flatMap(mod -> mod.getAffectedKeys().stream()).distinct().toArray(); if (log.isTraceEnabled()) { log.tracef( "Sending end invalidation for keys %s asynchronously, modifications are %s", Arrays.toString(keys), ctx.getCacheTransaction().getModifications()); } GlobalTransaction globalTransaction = ctx.getGlobalTransaction(); EndInvalidationCommand commitCommand = cacheCommandInitializer.buildEndInvalidationCommand( cacheName, keys, globalTransaction); List<Address> members = distributionManager.getCacheTopology().getMembers(); rpcManager.invokeRemotely(members, commitCommand, asyncUnordered); // If the transaction is not successful, *RegionAccessStrategy would not be called, therefore // we have to end invalidation from here manually (in successful case as well) for (Object key : keys) { putFromLoadValidator.endInvalidatingKey(globalTransaction, key); } } } } finally { return invokeNext(ctx, command); } }
} else { LocalizedCacheTopology cacheTopology = advancedCache(0).getDistributionManager().getCacheTopology(); List<Address> members = new ArrayList<>(cacheTopology.getMembers()); List<Address> owners = cacheTopology.getDistribution(key).readOwners(); members.removeAll(owners); nonOwner = cacheTopology.getMembers().indexOf(members.get(0)); c = cache(nonOwner);
log.debugf("Blocked state response from %s, killing %s", firstResponseSender.get(), manager(nodeToKill)); cache(nodeToKill).stop(); eventuallyEquals(3, () -> dm0.getCacheTopology().getMembers().size());