Skip to content

Commit 1037107

Browse files
authored
Fix #73: add Generators.defaultTimeBasedGenerator() (#72)
1 parent 7c7c4a0 commit 1037107

File tree

8 files changed

+686
-72
lines changed

8 files changed

+686
-72
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ UUID uuid = gen.generate();
7676
UUID anotherUuid = gen.generate();
7777
```
7878

79+
If your machine has a standard IP networking setup, the `Generators.defaultTimeBasedGenerator` (added in JUG 4.2)
80+
factory method will try to determine which network interface corresponds to the default route for
81+
all outgoing network traffic, and use that for creating a time based generator.
82+
This is likely a good choice for common usage scenarios if you want a version 1 UUID generator.
83+
84+
```java
85+
TimeBasedGenerator gen = Generators.defaultTimeBasedGenerator();
86+
UUID uuid = gen.generate();
87+
UUID anotherUuid = gen.generate();
88+
```
89+
7990
Generators are fully thread-safe, so a single instance may be shared among multiple threads.
8091

8192
Javadocs for further information can be found from [Project Wiki](../../wiki).

release-notes/CREDITS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ Hal Hildebrand (Hellblazer@github)
126126
Dirk-Jan Rutten (excitement-engineer@github)
127127
* Reported #69: UUID version 7 implementation sorting incorrect?
128128
[4.1.1]
129+
130+
Paul Galbraith (pgalbraith@github)
131+
* Contributed #52: Add `Generators.egressTimeBasedGenerator()` method that constructs
132+
`TimedBasedGenerator` with a sensible choice of interface

0 commit comments

Comments
 (0)