Algorithm · Tesla · Medium
Implement a class SnapshotCombiner that coordinates two threads observing a shared counter. The counter starts at 0 and is incremented by exactly 1 every millisecond by a background thread. Two observer threads are launched at the same instant as the background thread. The first observer waits until the counter reaches the value target, then records that value as firstSnapshot. The second observer sleeps for durationMillis milliseconds after the synchronized launch, then…
Checking your access…