Comments (1)
{"workerBits":23,"timeBits":31,"seqBits":9}
int workerIdShift = 9;//seqBits=9
int workerId = 52;//work node id
int timestampShift = 32;// protected int workerBits = 23; seqBits = 9; workerBits + seqBits
long beginId = 1672416000000L;//当前时间
while (true) {
long currentSeconds = TimeUnit.MILLISECONDS.toSeconds(beginId);
long epochSeconds = TimeUnit.MILLISECONDS.toSeconds(1545667200000L);//2018/12/25 0:0:0
long deltaSeconds = currentSeconds - epochSeconds;
long id = deltaSeconds << timestampShift | (workerId << workerIdShift) | 0L;
System.out.println("时间:" + beginId);
System.out.println("id" + id);
if (id <= 9223372036854775807L && id > 0) {
System.out.println("继续");
beginId += 1000 * 60 * 60 * 24;
} else {
System.out.println("停止");
break;
}
}
可用时间:3693139200000 (2087/1/13 0:0:0)ID = 9223322009075738624
from uid-generator.
Related Issues (20)
- There is a vulnerability in spring 4.2.5.RELEASE,upgrade recommended
- There is a vulnerability in logback 1.1.3,upgrade recommended
- Synchronized DefaultUidGenerator & ParallelGenerate
- 压测的具体操作方法能麻烦提供一下
- 64位虚机里 CacheLine 填充过长问题 HOT 1
- 中文文档里的sql建表语句执行报错 时间字段需要设置默认值 HOT 1
- 总共没几条sql,建议直接使用jdbc,不要在使用mybatis等框架 HOT 2
- 控制台日志频繁打印 HOT 1
- 请问该项目是不再维护了吗
- A component required a bean of type 'com.github.wujun234.uid.impl.CachedUidGenerator' that could not be found. HOT 1
- 为啥不把delta seconds和worker id换个位置? HOT 1
- AtomicLong.updateAndGet()超级费CPU,并发一多就100% HOT 1
- 这个吞吐量怎么算出来的?
- BufferPaddingExecutor中的lastSecond的疑问
- 报错 UidGenerateExption :java.RuntimeExecption :Rejected take buffer . RingBuffer [bufferize=65536,tail=65536,cursor=65536,paddingThreshold=32768] HOT 5
- 机器 id,最多可支持约 420w 次机器启动 HOT 2
- 时间戳运算代码是不是写错了 HOT 1
- 有没有升级为springboot版的 HOT 1
- No qualifying bean of type 'com.github.wujun234.uid.UidGenerator' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@jakarta.annotation.Resource(shareable=true, lookup="", name="", description="", authenticationType=CONTAINER, type=java.lang.Object.class, mappedName="")}
- 什么时候出个go语言版本的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uid-generator.