Skip to content

Commit c0768bd

Browse files
authored
stopAndWait should terminate default actor system (#861)
1 parent c4cc00d commit c0768bd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala

+3-8
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ import org.elasticmq.actor.QueueManagerActor
1111
import org.elasticmq.metrics.QueuesMetrics
1212
import org.elasticmq.rest.sqs.Constants._
1313
import org.elasticmq.rest.sqs.XmlNsVersion.extractXmlNs
14-
import org.elasticmq.rest.sqs.directives.{
15-
AWSProtocolDirectives,
16-
AnyParamDirectives,
17-
ElasticMQDirectives,
18-
UnmatchedActionRoutes
19-
}
14+
import org.elasticmq.rest.sqs.directives.{AWSProtocolDirectives, AnyParamDirectives, ElasticMQDirectives, UnmatchedActionRoutes}
2015
import org.elasticmq.rest.sqs.model.RequestPayload
2116
import org.elasticmq.util.{Logging, NowProvider}
2217

@@ -127,7 +122,7 @@ case class TheSQSRestServerBuilder(
127122
this.copy(queueEventListener = Some(_queueEventListener))
128123

129124
def start(): SQSRestServer = {
130-
val (theActorSystem, _) = getOrCreateActorSystem
125+
val (theActorSystem, stopActorSystem) = getOrCreateActorSystem
131126
val theQueueManagerActor = getOrCreateQueueManagerActor(theActorSystem)
132127
val theServerAddress =
133128
if (generateServerAddress)
@@ -279,7 +274,7 @@ case class TheSQSRestServerBuilder(
279274

280275
SQSRestServer(
281276
appStartFuture,
282-
() => appStartFuture.flatMap(_.terminate(1.minute))
277+
() => appStartFuture.flatMap(_.terminate(1.minute)).flatMap(_ => stopActorSystem())
283278
)
284279
}
285280

0 commit comments

Comments
 (0)