org.codehaus.aspectwerkz.proxy
Class Uuid

java.lang.Object
  extended by org.codehaus.aspectwerkz.proxy.Uuid

public final class Uuid
extends Object

NOTE:

This code is based on code from the [Plasmid Replication Engine] project.
Licensed under [Mozilla Public License 1.0 (MPL)].

Original JavaDoc:

Our distributed objects are generally named most efficiently (and cleanly) by their UUID's. This class provides some static helpers for using UUID's. If it was efficient to do in Java, I would make the uuid an normal class and use instances of it. However, in current JVM's, we would end up using an Object to represent a long, which is pretty expensive. Maybe someday. ###

UUID format: currently using currentTimeMillis() for the low bits. This uses about 40 bits for the next 1000 years, leaving 24 bits for debugging and consistency data. I'm using 8 of those for a magic asci 'U' byte.

Future: use one instance of Uuid per type of object for better performance and more detailed info (instance could be matched to its uuid's via a map or array). This all static version bites.###


Field Summary
protected static long lastTime
           
static long UUID_MAGIC
           
static long UUID_MAGICMASK
           
static long UUID_NONE
           
static long UUID_WILD
           
 
Constructor Summary
Uuid()
           
 
Method Summary
static boolean isValid(long uuid)
          Returns true if uuid could have been generated by Uuid.
static long newUuid()
          Generate and return a new Universally Unique ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UUID_NONE

public static final long UUID_NONE
See Also:
Constant Field Values

UUID_WILD

public static final long UUID_WILD
See Also:
Constant Field Values

UUID_MAGICMASK

public static final long UUID_MAGICMASK
See Also:
Constant Field Values

UUID_MAGIC

public static final long UUID_MAGIC
See Also:
Constant Field Values

lastTime

protected static long lastTime
Constructor Detail

Uuid

public Uuid()
Method Detail

newUuid

public static long newUuid()
Generate and return a new Universally Unique ID. Happens to be monotonically increasing.


isValid

public static boolean isValid(long uuid)
Returns true if uuid could have been generated by Uuid.



Copyright © 2002-2005 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.