Class UUIDv7Generator

Object
org.apache.spark.util.UUIDv7Generator

public final class UUIDv7Generator extends Object
Generator for UUIDv7 as defined in RFC 9562. https://www.rfc-editor.org/rfc/rfc9562.html UUIDv7 is a time-ordered UUID that embeds a Unix timestamp in milliseconds. Monotonicity is best-effort but not strictly guaranteed by this implementation, in rare cases such as concurrent generation within the same millisecond or clock adjustments. This trade-off is intentional to avoid throughput degradation or thread contention.
  • Method Details

    • generate

      public static UUID generate()
      Generate a UUIDv7 from the current time. The generated UUID embeds a 48-bit Unix timestamp (milliseconds since epoch), followed by random bits for uniqueness. Monotonicity is best-effort: UUIDs generated across different milliseconds will be ordered, but UUIDs within the same millisecond may have random ordering.
      Returns:
      a new UUIDv7