Class UniqueIdGenerator


  • @Internal
    public class UniqueIdGenerator
    extends java.lang.Object
    Generate unique IDs that can be used to differentiate different jobs and partitions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateRowKeyPrefix()
      Return a random base64 encoded 8 byte string.
      static java.lang.String getNextId()
      Return a random base64 encoded 8 byte string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UniqueIdGenerator

        public UniqueIdGenerator()
    • Method Detail

      • getNextId

        public static java.lang.String getNextId()
        Return a random base64 encoded 8 byte string. This is used to identify streamer of a specific partition. We expect there to be at most single digit duplicates of the same partition at any one time. The odd of collision if we generate <10 values per partition is less than 1 in 10^18.
        Returns:
        a random 8 byte string.
      • generateRowKeyPrefix

        public static java.lang.String generateRowKeyPrefix()
        Return a random base64 encoded 8 byte string. This is used to identify a pipeline. Once a pipeline is complete, the metadata is left there and not cleaned up. It's possible, over the lifetime, there to be thousands and more pipelines in a single metadata table. The odds of collision if we expect 100,000 pipelines is less than 1 in 1 billion.
        Returns:
        a random 8 byte string.