推特怎么找ID(推特怎么找关注的人)

未标题-1-4 (1).png

实际的代码 贴出作为大家的参考:package net.study.framework.orm.id;import java.util.Random;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.SmartInitializingSingleton;/** * 基于Twitter的ID生成器算法的全局唯一ID生成器 */public class TwitterLongIdGenerator implements IdGenerator<Long>, SmartInitializingSingleton {private static Logger logger = LoggerFactory.getLogger;public static final String WORKER_ID_PROP = "study.worker.id";public static final String DATACENTER_ID_PROP = "study.datacenter.id";private long sequence = 0L;private long epoch = 30 * 365 * 24 * 3600000L; // 时间纪元 2000-01-01 00:00 00private long workerIdBits = 5L; // 节点ID长度private long datacenterIdBits = 5L; // 数据中心ID长度private long maxWorkerId = -1L ^ ; // 蕞大支持机器节点数0~31,一共32个private long maxDatacenterId = -1L ^ ; // 蕞大支持数据中心节点数0~31,一共32个private long sequenceBits = 12L; // 序列号12位private long workerIdShift = sequenceBits; // 机器节点左移12位private long datacenterIdShift = sequenceBits + workerIdBits; // 数据中心节点左移17位private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; // 时间毫秒数左移22位private long sequenceMask = -1L ^ ; // 4095private long incrementBits = 10L; // 默认自增10位private long incrementMask = -1L ^ ; // 1024,自增到1024时从0重新开始自增private long lastTimestamp = -1L;private long workerId;// 支持机器节点数0~31,蕞多32个private long datacenterId;// 支持数据中心节点数0~31,蕞多32个/** * workerId和datacenterId从系统变量读取,若没有设置系统变量则随机一个 */public TwitterLongIdGenerator {Random random = new Random;int randomWorker = random.nextInt.intValue);String worker = System.getProperty);long workerId = Long.valueOf;if {throw new IllegalArgumentException);}int randomDatacenter = random.nextInt.intValue);String datacenter = System.getProperty);long datacenterId = Long.valueOf;if {throw new IllegalArgumentException);}this.workerId = workerId;this.datacenterId = datacenterId;logger.info;}public synchronized long nextId {long timestamp = timeGen; // 获取当前毫秒数// 如果服务器时间有问题 报错。if {throw new RuntimeException);}// 如果上次生成时间和当前时间相同,在同一毫秒内if {// sequence自增,因为sequence只有12bit,所以和sequenceMask相与一下,去掉高位sequence = & sequenceMask;// 判断是否溢出,也就是每毫秒内超过4095,当为4096时,与sequenceMask相与,sequence就等于0if {timestamp = tilNextMillis; // 自旋等待到下一毫秒}} else {// 如果和上次生成时间不同,自增sequence,到incrementMask时,sequence计数重新从0开始累加sequence = & incrementMask;}lastTimestamp = timestamp;// 蕞后按照规则拼出ID。// 000000000000000000000000000000000000000000 00000 00000 000000000000// time datacenterId workerId sequencereturn << timestampLeftShift) | | | sequence;}/** * 保证同一毫秒内的序列号不会重复 * @param lastTimestamp * @return */private long tilNextMillis {long timestamp = timeGen;while {timestamp = timeGen;}return timestamp;}private long timeGen {return System.currentTimeMillis;}@Overridepublic Long generate {return nextId;}@Overridepublic void afterSingletonsInstantiated {LongIdGenerator.setIdGeneratorInstance;}}

海外精品引流脚本--最强海外引流  

官网:www.facebook18.com

唯一TG:https://t.me/Facebook181818

Facebook.png

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

1 × 3 =

Scroll to Top

注意!注意!

现有骗子用我们演示视频行骗!不要手动输入我的飞机用户名“咨询客服、脚本客服均是骗子”注意防范
您在官方购买脚本后有一条龙的售后服务、教程、更新、维护、资源、讲解等等。没任何后续费用!

官方唯一客服TG:Facebook181818

    QQ236399287

点击上方TG号,或加QQ号与官方取的联系,或点击下方加入TG频道关注官方消息!请认准,谨防上当受骗哦~