snowflake

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

License

License

GroupId

GroupId

xyz.downgoon
ArtifactId

ArtifactId

snowflake
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

snowflake
java edition of Twitter Snowflake: a network service for generating unique ID numbers at high scale with some simple guarantees
Source Code Management

Source Code Management

http://github.com/downgoon/snowflake

Download snowflake

How to add to project

<!-- https://jarcasting.com/artifacts/xyz.downgoon/snowflake/ -->
<dependency>
    <groupId>xyz.downgoon</groupId>
    <artifactId>snowflake</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/xyz.downgoon/snowflake/
implementation 'xyz.downgoon:snowflake:1.0.0'
// https://jarcasting.com/artifacts/xyz.downgoon/snowflake/
implementation ("xyz.downgoon:snowflake:1.0.0")
'xyz.downgoon:snowflake:jar:1.0.0'
<dependency org="xyz.downgoon" name="snowflake" rev="1.0.0">
  <artifact name="snowflake" type="jar" />
</dependency>
@Grapes(
@Grab(group='xyz.downgoon', module='snowflake', version='1.0.0')
)
libraryDependencies += "xyz.downgoon" % "snowflake" % "1.0.0"
[xyz.downgoon/snowflake "1.0.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.4

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.0.0