Class AutoIncIdGenerator

java.lang.Object
ai.djl.serving.wlm.util.AutoIncIdGenerator

public class AutoIncIdGenerator extends Object
Class to generate an unique worker id.
  • Constructor Details

    • AutoIncIdGenerator

      public AutoIncIdGenerator(String prefix)
      Constructs an AutoIncIdGenerator.
      Parameters:
      prefix - the prefix for the set of IDs
  • Method Details

    • generate

      public String generate()
      Generates a new worker id.
      Returns:
      returns a new id.
    • generateNum

      public int generateNum()
      Generates a new worker id without the prefix.
      Returns:
      returns a new id without the prefix.
    • stripPrefix

      public int stripPrefix(String id)
      Removes the prefix to a generated Id.
      Parameters:
      id - the prefixed id
      Returns:
      the num value of the id