Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

UUID Concept

Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UUID is Unique Universal Identifier. I would like to understand how is it possible to generate the unique identifier universally? How UUID achieves this?
Posts: 3122
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the Wikipedia article?
Saloon Keeper
Posts: 22123
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A UUID/GUID (Microsoft's name for it) is as one person put it, is a generated value whose likelihood of being duplicated by any other generator (or for that matter the same generator) is about the same as the probability of random atoms rushing together in empty space to form a small walnut. The number of potential UUIDs in fact, exceeds the number of atoms in the Universe.

This makes them ideal for generating identifiers for distributed systems that need to periodically sync up, since each node of the system can generate IDs in the near-100% assurance that no other node would have assigned the same ID to something else. UUIDs have been used to distinguish OLE/COM service providers, uniquely identify disk drives and partitions without regard to where they are plugged in, and for many other purposes.

They are, in effect, very long (128 bit) random numbers and generated by much the same means. Java, in fact, has a UUID generator, so it's easy to create your own UUIDs.

One thing to note, however, is that since they are almost totally random, they make for lousy database keys, since they're rather large to be used as simple hash values, and they have no inherent order that would help optimise sequential searching and retrieval.

Some people consider UUIDs and GUIDs to be the same thing, but that's not entirely true. If you look at a Windows GUID, you'll notice that the displayed version of the ID is broken into parts. Originally Microsoft was parceling out specific high-level ID components for the benefit of themselves and registered developers. So only part of the GUID was truly random. Sometimes, indeed, very little of it.
Posts: 7619
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have suspicion, that OP wants to know a bit more how actually the uniqueness is achieved across the globe (in simple words saying).

How the identifier is obtained, for instance: is the current time taken in consideration, date, maybe some local machines hardware figures, etc, etc...

Is that what's you worrying?
What's brown and sticky? ... a stick. Or a tiny ad.
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
    Bookmark Topic Watch Topic
  • New Topic