1 4 package com.tc.aspectwerkz.proxy; 5 6 29 public final class Uuid { 30 31 public static final long UUID_NONE = 0; 32 public static final long UUID_WILD = -1; 33 public static final long UUID_MAGICMASK = 0xff << 56; 34 public static final long UUID_MAGIC = 'U' << 56; 35 36 protected static long lastTime; 37 38 42 public synchronized static long newUuid() { 43 long time = System.currentTimeMillis(); 44 45 if (time <= lastTime) { 46 time = lastTime + 1; 47 } 48 lastTime = time; 49 return UUID_MAGIC | time; 50 } 51 52 55 public static boolean isValid(final long uuid) { 56 return (uuid & UUID_MAGICMASK) == UUID_MAGIC 57 && (uuid & ~UUID_MAGICMASK) != 0; 58 } 59 } 60 61 | Popular Tags |