use blocking-io-dispatcher correctly in OutputStreamSource, #20666

* it used the materializer dispatcher for the blocking take
* it was leaking threads (blocking threads) when when materializer was shutdown abruptly
This commit is contained in:
Patrik Nordwall 2016-05-31 08:47:22 +02:00
parent be448e9fbb
commit b97a72c773
4 changed files with 74 additions and 20 deletions

View file

@ -29,7 +29,7 @@ public class OutputStreamSinkTest extends StreamTest {
}
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource = new AkkaJUnitActorSystemResource("OutputStreamSink",
public static AkkaJUnitActorSystemResource actorSystemResource = new AkkaJUnitActorSystemResource("OutputStreamSinkTest",
Utils.UnboundedMailboxConfig());
@Test
public void mustSignalFailureViaIoResult() throws Exception {
@ -44,7 +44,7 @@ public class OutputStreamSinkTest extends StreamTest {
}
};
final CompletionStage<IOResult> resultFuture = Source.single(ByteString.fromString("123456")).runWith(StreamConverters.fromOutputStream(() -> os), materializer);
final IOResult result = resultFuture.toCompletableFuture().get(300, TimeUnit.MILLISECONDS);
final IOResult result = resultFuture.toCompletableFuture().get(3000, TimeUnit.MILLISECONDS);
assertFalse(result.wasSuccessful());
assertTrue(result.getError().getMessage().equals("Can't accept more data."));