title: Make an actor sleep
body: <p>I want to make an actor sleep for a while, specifically it should decide whether to sleep <strong>itself</strong> depending on a condition:</p>
  
  <pre><code>class MyActor extends Actor {
    def receive {
      case "doWork" =&gt; doWork()
    }
  
    def doWork(): Unit = {
      // doing some work
      val condition = calculateCondition
      if (condition) {
        // sleep for 5 seconds
        // Thread.sleep(5000) 
      }
    }
  }
  </code></pre>
  
  <p>I'm pretty much sure it's not a good thing to call <code>Thread.sleep(5000)</code>  inside an actor and there should be another way. Therefore, how do I make it sleep?</p>