+act - 15757 - Reworks implementation of ActorSystem shutdown

* deprecates awaitTermination, shutdown and isTerminated
  * introduces a terminate-method that returns a Future[Unit]
  * introduces a whenTerminated-method that returns a Future[Unit]
  * simplifies the implementation by removing blocking constructs
  * adds tests for terminate() and whenTerminated
This commit is contained in:
Viktor Klang 2014-08-25 15:49:28 +02:00
parent 3ca27a54ad
commit cd8e97c060
51 changed files with 183 additions and 169 deletions

View file

@ -22,7 +22,7 @@ object EchoServer extends App {
// make sure to stop the system so that the application stops
try run()
finally system.shutdown()
finally system.terminate()
def run(): Unit = {
import ActorDSL._

View file

@ -10,6 +10,9 @@ import java.net.InetSocketAddress
import akka.testkit.{ ImplicitSender, TestProbe, AkkaSpec }
import akka.util.ByteString
import scala.concurrent.Await
import scala.concurrent.duration.Duration
object PullReadingExample {
class Listener(monitor: ActorRef) extends Actor {
@ -77,7 +80,6 @@ class PullReadingSpec extends AkkaSpec with ImplicitSender {
client.send(connection, ResumeReading)
client.expectMsg(Received(ByteString("hello")))
system.shutdown()
system.awaitTermination
Await.ready(system.terminate(), Duration.Inf)
}
}