InternalClock
Low-resolution clock optimized for frequent access in the scheduler.
While System.currentTimeMillis is accurate, calling it frequently creates significant overhead due to system calls. This clock uses a dedicated thread to update a volatile timestamp every millisecond, allowing other threads to read the current time without system calls.
The tradeoff of potentially being off by up to a millisecond is acceptable for scheduler operations like measuring task runtime and detecting stalled workers. The performance benefit of avoiding system calls on every time check is substantial when processing thousands of tasks per second.
The clock self-corrects any drift by measuring the actual elapsed time between updates.
Value parameters
- executor
-
Executor for running the update thread
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any