Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ISPN-1780 Identify more code benefitting from the new API hash.primar…

…yLocation(key)
  • Loading branch information...
commit 0a261d24a85165f05d67b414abcc34822e91eb67 1 parent 16ba461
@Sanne authored
View
6 core/src/main/java/org/infinispan/affinity/KeyAffinityServiceImpl.java
@@ -361,11 +361,7 @@ private boolean interestedInAddress(Address address) {
private Address getAddressForKey(Object key) {
DistributionManager distributionManager = getDistributionManager();
ConsistentHash hash = distributionManager.getConsistentHash();
- List<Address> addressList = hash.locate(key, 1);
- if (addressList.size() == 0) {
- throw new IllegalStateException("Empty address list returned by consistent hash " + hash + " for key " + key);
- }
- return addressList.get(0);
+ return hash.primaryLocation(key);
}
private boolean isNodeInConsistentHash(Address address) {
View
3  core/src/main/java/org/infinispan/statetransfer/ReplicatedStateTransferTask.java
@@ -138,8 +138,7 @@ private void replicate(Object key, InternalCacheEntry value, ConsistentHash chOl
CacheStore cacheStore, ByRef<Collection<InternalCacheEntry>> stateRef) throws StateTransferCancelledException {
// 1. Get the old primary owner for key K
// That node will be the "pushing owner" for key K
- List<Address> oldOwners = chOld.locate(key, 1);
- Address pushingOwner = oldOwners.size() > 0 ? oldOwners.get(0) : null;
+ final Address pushingOwner = chOld.primaryLocation(key);
if (trace) log.tracef("Replicating key %s, pushing owner is %s",
key, pushingOwner);
Please sign in to comment.
Something went wrong with that request. Please try again.