日期:2014-05-20 浏览次数:20704 次
public final static synchronized String generate(Object o) {
long id1 = System.currentTimeMillis() & 0xFFFFFFFFL;
long id2 = System.identityHashCode(o);
long id3 = randomLong( -0x80000000L, 0x80000000L) & 0xFFFFFFFFL;
id1 <<= 16;
id1 += (id2 & 0xFFFF0000L) >> 16;
id3 += (id2 & 0x0000FFFFL) << 32;
String str = Format.convert(id1, 6, chars64) +
Format.convert(id3, 6, chars64);
//return locate + time + "_" + md5.getMD5ofStr(str);
return md5.getMD5ofStr(str);
}
public final synchronized static String generate() {
long id1 = System.currentTimeMillis() & 0x3FFFFFFFL;
long id3 = randomLong( -0x80000000L, 0x80000000L) & 0x3FFFFFFFL;
String str = Format.convert(id1, 6, chars64) +
Format.convert(id3, 6, chars64);
//return locate + time + "_" + md5.getMD5ofStr(str);
return md5.getMD5ofStr(str);
}