From f791cf123b6fb0a85603c80e0aef0556f77a7284 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 28 Jun 2016 13:47:23 +0200 Subject: [PATCH] stop PoolInterfaceActor on shutdown, #20842 (#20844) --- .../akka/http/impl/engine/client/PoolInterfaceActor.scala | 2 +- .../akka/http/scaladsl/model/EntityDiscardingSpec.scala | 4 ++-- .../scala/akka/http/scaladsl/model/MultipartSpec.scala | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/client/PoolInterfaceActor.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/client/PoolInterfaceActor.scala index 843ba4816a..1d0f7432ff 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/engine/client/PoolInterfaceActor.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/engine/client/PoolInterfaceActor.scala @@ -124,7 +124,7 @@ private class PoolInterfaceActor(gateway: PoolGateway)(implicit fm: Materializer case Shutdown ⇒ // signal coming in from gateway log.debug("Shutting down host connection pool to {}:{}", hcps.host, hcps.port) - onComplete() + onCompleteThenStop() while (!inputBuffer.isEmpty) { val PoolRequest(request, responsePromise) = inputBuffer.dequeue() responsePromise.completeWith(gateway(request)) diff --git a/akka-http-core/src/test/scala/akka/http/scaladsl/model/EntityDiscardingSpec.scala b/akka-http-core/src/test/scala/akka/http/scaladsl/model/EntityDiscardingSpec.scala index 6730d315c3..404da1e424 100644 --- a/akka-http-core/src/test/scala/akka/http/scaladsl/model/EntityDiscardingSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/scaladsl/model/EntityDiscardingSpec.scala @@ -60,8 +60,8 @@ class EntityDiscardingSpec extends AkkaSpec { val (_, host, port) = TestUtils.temporaryServerHostnameAndPort() val bound = Http().bindAndHandleSync( req ⇒ - HttpResponse(entity = HttpEntity( - ContentTypes.`text/csv(UTF-8)`, Source.fromIterator[ByteString](() ⇒ testData.iterator))), + HttpResponse(entity = HttpEntity( + ContentTypes.`text/csv(UTF-8)`, Source.fromIterator[ByteString](() ⇒ testData.iterator))), host, port).futureValue try { diff --git a/akka-http-core/src/test/scala/akka/http/scaladsl/model/MultipartSpec.scala b/akka-http-core/src/test/scala/akka/http/scaladsl/model/MultipartSpec.scala index 0882582ef5..998a3ffe2b 100644 --- a/akka-http-core/src/test/scala/akka/http/scaladsl/model/MultipartSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/scaladsl/model/MultipartSpec.scala @@ -4,13 +4,13 @@ package akka.http.scaladsl.model -import com.typesafe.config.{Config, ConfigFactory} +import com.typesafe.config.{ Config, ConfigFactory } import scala.concurrent.Await import scala.concurrent.duration._ -import org.scalatest.{BeforeAndAfterAll, Inside, Matchers, WordSpec} +import org.scalatest.{ BeforeAndAfterAll, Inside, Matchers, WordSpec } import akka.stream.ActorMaterializer -import akka.stream.scaladsl.{Sink, Source} +import akka.stream.scaladsl.{ Sink, Source } import akka.util.ByteString import akka.actor.ActorSystem import headers._ @@ -43,7 +43,7 @@ class MultipartSpec extends WordSpec with Matchers with Inside with BeforeAndAft val result = streamed.toEntity(boundary = "boundary") result.contentType shouldBe MediaTypes.`multipart/mixed`.withBoundary("boundary").withCharset(HttpCharsets.`UTF-8`) val encoding = Await.result(result.dataBytes.runWith(Sink.seq), 1.second) - encoding .map(_.utf8String).mkString shouldBe "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--" + encoding.map(_.utf8String).mkString shouldBe "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--" } }