cowtowncoder/java-uuid-generator

Absolute value time based generator

bluemarker1 opened this issue · 4 comments

Are there any consequences to taking the absolute value of:
Generators.timeBasedGenerator().generate()?

@cowtowncoder any thoughts?

Consequences like... ? You mean whether instance you get should be explicitly reused, or just always calling static accessor?

So: method will always construct a new generator instance; and when not passing EthernetAddress, a pseudo-address needs to be generated as well. So there is definitely some overhead in calling that method. Whether it really matters depends on usage: with light usage (like, at most a hundred per second or so), probably not very significant.

On the other hand, it should be safe to simply get an instance, store it as a static singleton (or ThreadLocal, if you prefer), and reuse. This if usage rate is high enough.

Is there any negative in taking the absolute value of the uuid big integer?

I don't understand the question here.