code: public int getPartition(K key, V value, 
                            int numPartitions) {
      Integer result = cache.get();
      if (result == null) {
        return part.getPartition(key, value, numPartitions);
      } else {
        return result;
      }
    }
docs: If a partition result was set manually, return it. Otherwise, we call
  the Java partitioner.
  @param key the key to partition
  @param value the value to partition
  @param numPartitions the number of reduces