@Test void getSeverTokenById() { IdGenerator idGenerator = idGeneratorFactory.getRoleIdGenerator(); Long generate1 = idGenerator.generate(); Long generate2 = idGenerator.generate(); int severTokenById1 = CommonUtils.getSeverTokenById(generate1); int severTokenById2 = CommonUtils.getSeverTokenById(generate2); logger.debug("{}",Integer.toBinaryString(severTokenById1)); Assertions.assertEquals(severTokenById1,severTokenById2); }
public static int getSeverTokenById(long id){ long tokenBitLength = IdGenerator.getDatacenterIdBits() + IdGenerator.getServerIdBits(); long tokenBitMax = ~(-1L << tokenBitLength); return (int)((id >> IdGenerator.getSequenceBits()) & tokenBitMax); }
CommonUtils { public static int getSeverTokenById(long id){ long tokenBitLength = IdGenerator.getDatacenterIdBits() + IdGenerator.getServerIdBits(); long tokenBitMax = ~(-1L << tokenBitLength); return (int)((id >> IdGenerator.getSequenceBits()) & tokenBitMax); } }
CommonUtils { public static int getSeverTokenById(long id){ long tokenBitLength = IdGenerator.getDatacenterIdBits() + IdGenerator.getServerIdBits(); long tokenBitMax = ~(-1L << tokenBitLength); return (int)((id >> IdGenerator.getSequenceBits()) & tokenBitMax); }  }
CommonUtils { public static int getSeverTokenById(long id){ long tokenBitLength = IdGenerator.getDatacenterIdBits() + IdGenerator.getServerIdBits(); long tokenBitMax = ~(-1L << tokenBitLength); return (int)((id >> IdGenerator.getSequenceBits()) & tokenBitMax); }  static int getSeverTokenById(long id); }
CommonUtils { public static int getSeverTokenById(long id){ long tokenBitLength = IdGenerator.getDatacenterIdBits() + IdGenerator.getServerIdBits(); long tokenBitMax = ~(-1L << tokenBitLength); return (int)((id >> IdGenerator.getSequenceBits()) & tokenBitMax); }  static int getSeverTokenById(long id);  }