Package me.ahoo.cosid

Interface IdGenerator

All Known Implementing Classes:
SegmentGenerator, TimeBasedGenerator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IdGenerator
Generates long ids.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    The next id.
  • Method Details

    • generate

      long generate()
      The next id. An implementation, such as one given as a custom generator, is thread-safe: any number of threads call it concurrently, and it never issues an id twice.
      Returns:
      the id