Package ai.djl.serving.wlm.util
Class AutoIncIdGenerator
java.lang.Object
ai.djl.serving.wlm.util.AutoIncIdGenerator
Class to generate an unique worker id.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate()Generates a new worker id.intGenerates a new worker id without the prefix.intstripPrefix(String id) Removes the prefix to a generated Id.
-
Constructor Details
-
AutoIncIdGenerator
Constructs anAutoIncIdGenerator.- Parameters:
prefix- the prefix for the set of IDs
-
-
Method Details
-
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
Removes the prefix to a generated Id.- Parameters:
id- the prefixed id- Returns:
- the num value of the id
-