Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UID

 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the Javadoc:

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic