wood burning stoves 2.0*
The moose likes Java in General and the fly likes UID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "UID" Watch "UID" New topic
Author

UID

shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UID
 
Similar Threads
Sessions and Proxyserver problem
Application hangs with prior J2CA0086W warning messages
Creating Unique Id
Uniqueness of UUID
Best way to generate PK in EJB