Materializer settings as attributes (#27499)

* Replace MaterializerSettings with Attributes #25559 
 * Field access to settings deprecated to make stages use attributes instead
 * Internal stages updated to use attributes
 * Docs on ActorMaterializerSettings updated to recommend away from using it
 * Verify all stages stopped after each testcase in FlowGroupBySpec
 * Subscription timeout attributes merged into one
This commit is contained in:
Johan Andrén 2019-09-04 13:37:06 +02:00 committed by GitHub
parent b9a879d722
commit aca63ea198
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 1596 additions and 1116 deletions

View file

@ -39,8 +39,6 @@ class MapAsyncBenchmark {
implicit val system = ActorSystem("MapAsyncBenchmark", config)
import system.dispatcher
var materializer: ActorMaterializer = _
var testSource: Source[java.lang.Integer, NotUsed] = _
@Param(Array("1", "4"))
@ -51,9 +49,8 @@ class MapAsyncBenchmark {
@Setup
def setup(): Unit = {
val settings = ActorMaterializerSettings(system)
materializer = ActorMaterializer(settings)
// eager init of materializer
SystemMaterializer(system).materializer
testSource = Source.fromGraph(new BenchTestSource(OperationsPerInvocation))
}
@ -69,7 +66,7 @@ class MapAsyncBenchmark {
testSource
.mapAsync(parallelism)(elem => if (spawn) Future(elem) else Future.successful(elem))
.runWith(new LatchSink(OperationsPerInvocation, latch))(materializer)
.runWith(new LatchSink(OperationsPerInvocation, latch))
awaitLatch(latch)
}
@ -81,14 +78,14 @@ class MapAsyncBenchmark {
testSource
.mapAsyncUnordered(parallelism)(elem => if (spawn) Future(elem) else Future.successful(elem))
.runWith(new LatchSink(OperationsPerInvocation, latch))(materializer)
.runWith(new LatchSink(OperationsPerInvocation, latch))
awaitLatch(latch)
}
private def awaitLatch(latch: CountDownLatch): Unit = {
if (!latch.await(30, TimeUnit.SECONDS)) {
StreamTestKit.printDebugDump(materializer.supervisor)
StreamTestKit.printDebugDump(ActorMaterializerHelper.downcast(SystemMaterializer(system).materializer).supervisor)
throw new RuntimeException("Latch didn't complete in time")
}
}