-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
BaseUniqueIDGenerator uses System.currentTimeMillis to determine the current millisecond.
This makes it impossible to regenerate a sequence of IDs given a sequence of timestamps and calls to the IDGenerator. So this library can't be used in deterministic systems that need to replay a sequence of events and regenerate the exact same IDs. It also makes it impossible to write deterministic tests.
It would be nice if it was possible to pass a 'Clock' to the interface. The Clock might have a single method, 'currentTimeMillis()'. Custom implementations could provide their own Clock implementation which would provide for determinism. The default 'WallClock' could of course continue to use System.currrentTimeMillis() to get the wall time.
Metadata
Metadata
Assignees
Labels
No labels