File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
hibernate-core/src/main/java/org/hibernate/id/uuid Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 36
36
* @author Cedomir Igaly
37
37
*/
38
38
public class UuidVersion6Strategy implements UUIDGenerationStrategy , UuidValueGenerator {
39
-
40
39
public static final UuidVersion6Strategy INSTANCE = new UuidVersion6Strategy ();
41
40
42
- private static final Instant EPOCH_1582 = LocalDate .of ( 1582 , 10 , 15 )
43
- .atStartOfDay ( ZoneId .of ( "UTC" ) )
44
- .toInstant ();
45
-
46
41
private static class Holder {
47
42
static final SecureRandom numberGenerator = new SecureRandom ();
43
+ static final Instant EPOCH_1582 = LocalDate .of ( 1582 , 10 , 15 )
44
+ .atStartOfDay ( ZoneId .of ( "UTC" ) )
45
+ .toInstant ();
48
46
}
49
47
50
48
private final Lock lock = new ReentrantLock ( true );
@@ -112,7 +110,7 @@ private long getSequence(final long currentTimestamp) {
112
110
}
113
111
114
112
private static long getCurrentTimestamp () {
115
- final Duration duration = Duration .between ( EPOCH_1582 , Instant .now () );
113
+ final Duration duration = Duration .between ( Holder . EPOCH_1582 , Instant .now () );
116
114
return duration .toSeconds () * 10_000_000 + duration .toNanosPart () / 100 ;
117
115
}
118
116
}
You can’t perform that action at this time.
0 commit comments