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 3636 * @author Cedomir Igaly
3737 */
3838public class UuidVersion6Strategy implements UUIDGenerationStrategy , UuidValueGenerator {
39-
4039 public static final UuidVersion6Strategy INSTANCE = new UuidVersion6Strategy ();
4140
42- private static final Instant EPOCH_1582 = LocalDate .of ( 1582 , 10 , 15 )
43- .atStartOfDay ( ZoneId .of ( "UTC" ) )
44- .toInstant ();
45-
4641 private static class Holder {
4742 static final SecureRandom numberGenerator = new SecureRandom ();
43+ static final Instant EPOCH_1582 = LocalDate .of ( 1582 , 10 , 15 )
44+ .atStartOfDay ( ZoneId .of ( "UTC" ) )
45+ .toInstant ();
4846 }
4947
5048 private final Lock lock = new ReentrantLock ( true );
@@ -112,7 +110,7 @@ private long getSequence(final long currentTimestamp) {
112110 }
113111
114112 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 () );
116114 return duration .toSeconds () * 10_000_000 + duration .toNanosPart () / 100 ;
117115 }
118116}
You can’t perform that action at this time.
0 commit comments