An open API service indexing awesome lists of open source software.

https://github.com/downgoon/snowflake

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.
https://github.com/downgoon/snowflake

auto-increment id-generator sequence snowflake unique-id uuid

Last synced: 10 months ago
JSON representation

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.

Awesome Lists containing this project

README

          

# Snowflake

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.

## QuickStart

- import maven dependency

``` xml

xyz.downgoon
snowflake
1.0.0

```

- sample code

``` java
// 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](src/test/java/xyz/downgoon/snowflake/SnowflakeDemo2.java).

## snowflake tutorial

- [snowflake tutorial](docs/SnowflakeTutorial_zh_CN.md):中文教程