code: public static <K, V> KeyAffinityService<K> newKeyAffinityService(Cache<K, V> cache, Executor ex, KeyGenerator<K> keyGenerator, int keyBufferSize, boolean start) {
        return new KeyAffinityServiceImpl<>(ex, cache, keyGenerator, keyBufferSize, null, start);
     }
docs: Creates an {@link org.infinispan.affinity.KeyAffinityService} instance that generates keys mapped to all addresses
  in the cluster. Changes in topology would also noticed: by adding a new node, the service will automatically start
  generating keys for it.
  
  @param cache         the distributed cache for which this service runs
  @param ex            used for running async key generation process. On service shutdown, the executor won't be
  stopped; i.e. it's user responsibility manage it's lifecycle.
  @param keyGenerator  allows one to control how the generated keys look like.
  @param keyBufferSize the number of generated keys per {@link org.infinispan.remoting.transport.Address}.
  @param start         weather to start the service or not
  @return an {@link org.infinispan.affinity.KeyAffinityService} implementation.
  @throws IllegalStateException if the supplied cache is not DIST.