Class UDCIDGenerator

java.lang.Object
com.nt.udc.util.UDCIDGenerator

public class UDCIDGenerator extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    newID(String host, int port)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UDCIDGenerator

      public UDCIDGenerator()
  • Method Details

    • newID

      public static String newID(String host, int port) throws UnknownHostException
      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