Can I use java.rmi.dgc.VMID to generate a unique number even if i deploy my application in different hosts and /or environments. I have a web application which will deployed in an app server. SO i need to make sure that the UID i generate is unique even if i change my app server or my machine. Or if there is any other solution, pls let me know. SHankar.
Create a new VMID. Each new VMID returned from this constructor is unique for all Java virtual machines under the following conditions: a) the conditions for uniqueness for objects of the class java.rmi.server.UID are satisfied, and b) an address can be obtained for this host that is unique and constant for the lifetime of this object.
The significant constraint for UID is that the clock will never be turned back on the server. Assuming that is a reasonable assumption, you should be ok.