public static <K, V> DistributedMember getPrimaryMemberForKey(final Region<K, V> r, final K key) {
    PartitionedRegion pr = isPartitionedCheck(r);
    int bucketId = PartitionedRegionHelper.getHashKey(pr, null, key, null, null);
    return pr.getBucketPrimary(bucketId);
  }
Get the current primary owner for a key. Upon return there is no guarantee that primary owner
remains the primary owner, or that the member is still alive.
<p>
This method is not a substitute for {@link Region#containsKey(Object)}.
<p>

@param <K> The key type of the region
@param <V> The value type of the region
@param r a PartitionedRegion
@param key the key to evaluate
@throws IllegalStateException if the provided region is something other than a
        {@linkplain DataPolicy#PARTITION partitioned Region}
@return the primary member for the key, possibly null if a primary is not yet determined
@since GemFire 6.0
geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java