Merge pull request #19711 from johanandren/wip-19710-scala-types-attributes-java-api-johanandren

!str #19710 Use Java types in Attributes Java API
This commit is contained in:
Johan Andrén 2016-02-10 13:15:14 +01:00
commit f042204d8b
4 changed files with 66 additions and 21 deletions

View file

@ -445,7 +445,7 @@ private[akka] final case class Batch[In, Out](max: Long, costFn: In ⇒ Long, se
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
val decider = inheritedAttributes.getAttribute(classOf[SupervisionStrategy]).map(_.decider).getOrElse(Supervision.stoppingDecider)
val decider = inheritedAttributes.get[SupervisionStrategy].map(_.decider).getOrElse(Supervision.stoppingDecider)
private var agg: Out = null.asInstanceOf[Out]
private var left: Long = max
@ -637,7 +637,7 @@ private[akka] final case class MapAsync[In, Out](parallelism: Int, f: In ⇒ Fut
override def toString = s"MapAsync.Logic(buffer=$buffer)"
//FIXME Put Supervision.stoppingDecider as a SupervisionStrategy on DefaultAttributes.mapAsync?
val decider = inheritedAttributes.getAttribute(classOf[SupervisionStrategy]).map(_.decider).getOrElse(Supervision.stoppingDecider)
val decider = inheritedAttributes.get[SupervisionStrategy].map(_.decider).getOrElse(Supervision.stoppingDecider)
val buffer = new BoundedBuffer[Holder[Try[Out]]](parallelism)
def todo = buffer.used
@ -715,7 +715,7 @@ private[akka] final case class MapAsyncUnordered[In, Out](parallelism: Int, f: I
override def toString = s"MapAsyncUnordered.Logic(inFlight=$inFlight, buffer=$buffer)"
val decider =
inheritedAttributes.getAttribute(classOf[SupervisionStrategy])
inheritedAttributes.get[SupervisionStrategy]
.map(_.decider).getOrElse(Supervision.stoppingDecider)
var inFlight = 0
@ -953,7 +953,7 @@ private[stream] final class Delay[T](d: FiniteDuration, strategy: DelayOverflowS
override def initialAttributes: Attributes = DefaultAttributes.delay
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new TimerGraphStageLogic(shape) {
val size =
inheritedAttributes.getAttribute(classOf[InputBuffer]) match {
inheritedAttributes.get[InputBuffer] match {
case None throw new IllegalStateException(s"Couldn't find InputBuffer Attribute for $this")
case Some(InputBuffer(min, max)) max
}