Skip to content

Fix #73: add Generators.defaultTimeBasedGenerator() #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ UUID uuid = gen.generate();
UUID anotherUuid = gen.generate();
```

If your machine has a standard IP networking setup, the `Generators.defaultTimeBasedGenerator` (added in JUG 4.2)
factory method will try to determine which network interface corresponds to the default route for
all outgoing network traffic, and use that for creating a time based generator.
This is likely a good choice for common usage scenarios if you want a version 1 UUID generator.

```java
TimeBasedGenerator gen = Generators.defaultTimeBasedGenerator();
UUID uuid = gen.generate();
UUID anotherUuid = gen.generate();
```

Generators are fully thread-safe, so a single instance may be shared among multiple threads.

Javadocs for further information can be found from [Project Wiki](../../wiki).
Expand Down
4 changes: 4 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,7 @@ Hal Hildebrand (Hellblazer@github)
Dirk-Jan Rutten (excitement-engineer@github)
* Reported #69: UUID version 7 implementation sorting incorrect?
[4.1.1]

Paul Galbraith (pgalbraith@github)
* Contributed #52: Add `Generators.egressTimeBasedGenerator()` method that constructs
`TimedBasedGenerator` with a sensible choice of interface
Loading