Package hudson.util

Interface ConsistentHash.Hash<T>

Enclosing class:
ConsistentHash<T>

public static interface ConsistentHash.Hash<T>
Hashes an object to some value.

By default, ConsistentHash uses Object.toString() on 'T' to obtain the hash, but that behavior can be changed by providing a ConsistentHash.Hash implementation.

This hash function need not produce a very uniform distribution, as the output is rehashed with SHA-256. But it does need to make sure it doesn't produce the same value for two different 'T's (and that's why this returns String, not the usual int.)

  • Method Summary

    Modifier and Type
    Method
    Description
    hash(T t)
     
  • Method Details

    • hash

      String hash(T t)
      Parameters:
      t - The object to be hashed. Never null.
      Returns:
      The hash value.