The first timer will fire ~2s after we start the program, but the second should be stopped before it has a chance to fire.
In this Scala version:
We use Future and Promise to simulate timers.
The akka.pattern.after method is used to create a delayed future, similar to Go’s time.NewTimer.
Instead of channels, we use Future and its callbacks to handle timer completion.
The Promise allows us to manually complete or fail a future, which we use to simulate stopping a timer.
We use Thread.sleep instead of time.Sleep for simple delays.
Note that this Scala version requires the Akka library for the after method. In a real Scala project, you would typically use a build tool like SBT and include Akka as a dependency.