title: Scala: delay code bloc execution or cancel it
body: <p>I'm pretty new to Scala and have a background in Java.</p>
  
  <p>The problem I'm facing is that I'd like to execute a function after 5 minutes. And also be able to cancel this at any time.</p>
  
  <p>In java I would basically use <a href="https://docs.oracle.com/javase/7/docs/api/java/util/TimerTask.html" rel="nofollow noreferrer">TimerTask</a>, and set it to 5 min. If I would like to cancel, I just call <code>cancel</code> method. The nice thing is, I can use that Java class in Scala. But as I'm still learning Scala, I'm just wondering if I'm missing any better way of accomplishing that in a better way. I ran into <code>Future</code> and <code>Await.result</code> Scala classes, but I'm having a hard time figuring it out.</p>
  
  <p>Any advices?</p>