Class ClientFlakeIdGeneratorConfig


  • public class ClientFlakeIdGeneratorConfig
    extends java.lang.Object
    The ClientFlakeIdGeneratorConfig contains the configuration for the client regarding Flake ID Generator.
    • Constructor Detail

      • ClientFlakeIdGeneratorConfig

        public ClientFlakeIdGeneratorConfig​(java.lang.String name)
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the configuration name. This can be actual object name or pattern.
      • setPrefetchCount

        public ClientFlakeIdGeneratorConfig setPrefetchCount​(int prefetchCount)
        Sets how many IDs are pre-fetched on the background when one call to FlakeIdGenerator.newId() is made. Default is 100.
        Parameters:
        prefetchCount - the desired prefetch count, in the range 1..100,000.
        Returns:
        this instance for fluent API
      • setPrefetchValidityMillis

        public ClientFlakeIdGeneratorConfig setPrefetchValidityMillis​(long prefetchValidityMs)
        Sets for how long the pre-fetched IDs can be used. If this time elapses, a new batch of IDs will be fetched. Time unit is milliseconds, default is 600,000 (10 minutes).

        The IDs contain timestamp component, which ensures rough global ordering of IDs. If an ID is assigned to an object that was created much later, it will be much out of order. If you don't care about ordering, set this value to 0.

        Parameters:
        prefetchValidityMs - the desired ID validity or unlimited, if <=0
        Returns:
        this instance for fluent API
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object