Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

downgoon/snowflake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

13 Commits

Repository files navigation

Snowflake

java edition of Twitter Snowflake, a network service for generating unique ID numbers at high scale with some simple guarantees.

QuickStart

  • import maven dependency
<dependency>
 <groupId>xyz.downgoon</groupId>
 <artifactId>snowflake</artifactId>
 <version>1.0.0</version>
</dependency>
  • sample code
// datacenter: 2; workerId: 5
Snowflake snowflake = new Snowflake(2, 5);
long id1 = snowflake.nextId();
long id2 = snowflake.nextId();
snowflake.formatId(id1);

for more details, please read SnowflakeDemo2.java.

snowflake tutorial

About

java edition of [Twitter Snowflake](https://github.com/twitter/snowflake), a network service for generating unique ID numbers at high scale with some simple guarantees.

Topics

Resources

Stars

Watchers

Forks

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /