Package com.nt.udc.util
Class UDCIDGenerator
java.lang.Object
com.nt.udc.util.UDCIDGenerator
This class is used purely for the purpose of generating unique
UDC IDs. The specific items that use these unique ids include
UDC Nodes, Node Managers and Admin Servers. The purpose of the
unique ids is to reduce possible collisions when multiple Admin
servers need to be able to coexist in a network.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
This method will return a unique id that has been generated using the ip address and port of the server associated with whatever this id is being generated for, and it uses the timestamp (down to millisecond) at the moment the id is being generated.
-
Constructor Details
-
UDCIDGenerator
public UDCIDGenerator()
-
-
Method Details
-
newID
This method will return a unique id that has been generated using the ip address and port of the server associated with whatever this id is being generated for, and it uses the timestamp (down to millisecond) at the moment the id is being generated. The three units are then concatenated using a dash and each unit is converted to a decimal (long) value, and then converted to a base 36 (0-z) value in an effort to reduce the length of the unique identifier.- Parameters:
host
- Either the IP-address or host-name of the machine on which the object getting the id is running.port
- The port associated with the server (or object within the server) for which this id is being generated.- Returns:
- A String value representing the new id. The id has 3 parts each seperated by a '-'. The three parts represent a base 36 version of the IP, port, and time stamp.
- Throws:
UnknownHostException
-