Sudsy said:
Mark,
Sounds like a broken implementation. Does it claim to be ISO/IEC
11578:1996 compliant? The standard incorporates a random number,
something which should preclude the collisions you've observed.
compliant?
The new UUID class in 1.5 works properly --- it is a standard random
number based implementation.
The somewhat broken stuff are the classes java.rmi.dgc.VMID,
java.rmi.server.UID and related objects. These really require that you
have only one VM on a given machine and that you are using unique public
IP addresses (and don't have lots of machines with local addresses like
192.168.0.1 all communicating via NATing devices).
I found that it was quite easy on my work machine to start two JVM at
exactly the same time (as measured by System.currentTimeMillis). Both
JVM are then likely to generate exactly the same sequence of UID values.
For the intended use in server type applications these defficiencies are
probably unimportant. However I wanted to generate ids in client
applications where having multiple JVM instances would be far more
likely as would the prospect of using private IP address ranges. In this
case the probability of generating identical ids is unacceptably high.
Mark Thornton