Wednesday, October 13, 2010

Something new, something rather old: Java Uuid Generator, version 3.0

As briefly mention in the previous blog entry, Java Uuid Generator version 3.0 was just released. For those who do not know it, JUG is my first widely used Open Source library, dating to something like 2002; written when JDK 1.1 was still the bee's knees.

Version 3.0 is just a bit of refurbishing (2.0 was released almost 5 years ago), and no new functionality was added.
But it's good cleanup still, achieving following:

  • Move to using standard java.util.UUID (which came with JDK 1.4) for better interoperability
  • Build jar as an OSGi bundle (it has no dependencies, no big deal)
  • Deploy to Maven repos (using Sonatype OSS repository), use Maven for build as well
  • Better API: instead of a global static singleton UUIDGenerator, construct generator instances (for different methods)
  • Simplified synchronization (generators are fully synchronized)
  • Offer access to Ethernet address (MAC address) without native code, using JDK 1.6 method 'NetworkInterface.getHardwareAddress()'

Obvious downside is that API did change, so existing code that uses JUG 2.0 will not work as is. But since classes are now in package "com.fasterxml.uuid"), it is possible for both versions to co-exist. 3.0 will also require JDK 1.4 (2.0 could run on 1.1); or 1.6 if Ethernet address access functionality is needed.

Anyway, if you are using JUG 2.0, update probably makes sense and should be easy to do.

ps. Why use JUG over java.util.UUID? JDK version can only generate random-number based UUIDs and convert from bytes to UUIDs (or vice versa) -- JUG can generate other variants (name-based, time/location based).

blog comments powered by Disqus

Sponsored By


Related Blogs

(by Author (topics))

Powered By

About me

  • I am known as Cowtowncoder
  • Contact me at@yahoo.com
Check my profile to learn more.