Saturday 7 April 2012

Universally unique identifier (UUID)


Background:
The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. In this context the word unique should be taken to mean "practically unique" rather than "guaranteed unique". Since the identifiers have a finite size it is possible for two differing items to share the same identifier. The identifier size and generation process need to be selected so as to make this sufficiently improbable in practice. Anyone can create a UUID and use it to identify something with reasonable confidence that the same identifier will never be unintentionally created by anyone to identify something else. Information labeled with UUIDs can therefore be later combined into a single database without needing to resolve identifier (ID) conflicts.

The time based UUID generation algorithm supports very high allocation rates of up to 10 million per second per machine if necessary, so that they could even be used as transaction IDs.



Java Class: java.util.UUID
Methods you cans use to generate UUID are:

  • UUID.randomUUID();
  • UUID.nameUUIDFromBytes(bytesArray);
Reading: http://www.javapractices.com/topic/TopicAction.do?Id=56

No comments:

Post a Comment