zxid计算的相关,其中高32位存储Epoch的id,低32位存储事务的计数器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public class ZxidUtils {
public static long getEpochFromZxid(long zxid) { return zxid >> 32L; } public static long getCounterFromZxid(long zxid) { return zxid & 0xffffffffL; } public static long makeZxid(long epoch, long counter) { return (epoch << 32L) | (counter & 0xffffffffL); } public static String zxidToString(long zxid) { return Long.toHexString(zxid); }
}
|