Skip to content

Commit

Permalink
Clarify DistributedUniqueTimeProvider.currentTimeMillis() isn't inten…
Browse files Browse the repository at this point in the history
…ded to be unique and add tests #622
  • Loading branch information
peter-lawrey committed Apr 10, 2024
1 parent 5555130 commit fa721da
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
import java.io.File;

/**
* Provides unique timestamps across multiple systems by incorporating a host identifier into the timestamp.
* Provides unique timestamps across multiple systems by incorporating a host identifier into the timestamp, for microsecond and nanosecond resolution timestamps.
* This class is particularly useful in distributed systems where clock synchronization and uniqueness
* across hosts are critical. It implements {@link TimeProvider}.
* <p>
* NOTE: {@link #currentTimeMillis()} is not unique, it is just a call to the underlying provider as there isn't enough resolution to include the hostId.
* <p>
*
* Each timestamp generated is guaranteed to be unique across all hosts participating in the system.
* The class uses a file-based mechanism to ensure that timestamps are not only unique across restarts
Expand Down

0 comments on commit fa721da

Please sign in to comment.