A few weeks ago I asked my colleague Paul Hammant about GUID generation in java, specifically whether there were any open-source utilities to do it. He told me about a pair of little known classes called java.rmi.server.UID and java.rmi.dgc.VMID.
The UID class can generate identifiers that are unique over time within a JVM. The VMID class is even cooler – it provides uniqueness across ALL JVM’s. Why a class as generally useful as this is relegated to java’s distributed garbage collection package escapes me.
For the detail heads, UID consists of a unique number based on a hashcode, system time and a counter, and a VMID contains a UID and adds a SHA hash based on IP address.
Cool.
Pingback: Darren Hobbs » Blog Archive » Java GUID / UUID Update