Class Snowflake


  • public class Snowflake
    extends Object
    Author:
    callicoder: https://github.com/callicoder/java-snowflake

    Distributed Sequence Generator. Inspired by Twitter snowflake: https://github.com/twitter/snowflake/tree/snowflake-2010

    This class should be used as a Singleton. Make sure that you create and reuse a Single instance of Snowflake per node in your distributed system cluster.

    • Constructor Detail

      • Snowflake

        public Snowflake​(long nodeId,
                         long customEpoch)
      • Snowflake

        public Snowflake​(long nodeId)
      • Snowflake

        public Snowflake()
    • Method Detail

      • nextId

        public long nextId()
      • parse

        public long[] parse​(long id)