+str - #17662 - Changes Sink.ignore to return a Future[Unit]

This commit is contained in:
Viktor Klang 2015-06-05 18:26:32 +02:00
parent 8527e0347e
commit 3dd40fc18c
6 changed files with 15 additions and 13 deletions

View file

@ -150,15 +150,15 @@ private[akka] class HeadSink[In](val attributes: OperationAttributes, shape: Sin
* Attaches a subscriber to this stream which will just discard all received
* elements.
*/
private[akka] final class BlackholeSink(val attributes: OperationAttributes, shape: SinkShape[Any]) extends SinkModule[Any, Unit](shape) {
private[akka] final class BlackholeSink(val attributes: OperationAttributes, shape: SinkShape[Any]) extends SinkModule[Any, Future[Unit]](shape) {
override def create(context: MaterializationContext) = {
val effectiveSettings = ActorFlowMaterializer.downcast(context.materializer)
.effectiveSettings(context.effectiveAttributes)
(new BlackholeSubscriber[Any](effectiveSettings.maxInputBufferSize), ())
val effectiveSettings = ActorFlowMaterializer.downcast(context.materializer).effectiveSettings(context.effectiveAttributes)
val p = Promise[Unit]()
(new BlackholeSubscriber[Any](effectiveSettings.maxInputBufferSize, p), p.future)
}
override protected def newInstance(shape: SinkShape[Any]): SinkModule[Any, Unit] = new BlackholeSink(attributes, shape)
override protected def newInstance(shape: SinkShape[Any]): SinkModule[Any, Future[Unit]] = new BlackholeSink(attributes, shape)
override def withAttributes(attr: OperationAttributes): Module = new BlackholeSink(attr, amendShape(attr))
}