Giter Club home page Giter Club logo

javasnowflake's Introduction

javasnowflake

Java implementation of twitter snowflake. 64 bit sequential ID generator based on twitter snowflake ID generation algorithm. id is composed of: time - 41 bits (millisecond precision w/ a custom epoch gives us 69 years); configured machine id - 10 bits - gives us up to 1024 machines; sequence number - 12 bits - rolls over every 4096 per machine (with protection to avoid rollover in the same ms).

javasnowflake's People

Contributors

akhitev avatar predictor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javasnowflake's Issues

License

Hi,

under which license is javasnowflake? I saw that the original implementation from Twitter in Scala is published under Apache License. Does this also apply to your derived version? I need to clarify this issue before we can use your code in our projects (e.g. Apache Marmotta).

Nullpointer at BasicEntityIdGenerator.getDatacenterId()

Hello,

The latest version on Linux breaks because of a null pointer.

At line 81 getHardwareAddress() returns null which is then thrown at line 83 as mac has a null value.

81: byte[] mac = network.getHardwareAddress();
82: //System.out.println(DatatypeConverter.printHexBinary(mac));
83: long id = ((0x000000FF & (long)mac[mac.length-1]) | (0x0000FF00 & (((long)mac[mac.length-2])<<8)))>>6;

Negative ids

Hello,

Using the latest version, i still get negative Ids from some hosts. I use Amazon-deployed hosts; is this a problem for the algorithm?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.