Merge branch 'master' into wip-akka-docs-new
This commit is contained in:
commit
55f3c68ca4
21 changed files with 124 additions and 70 deletions
|
|
@ -192,6 +192,7 @@ For a pull request to be considered at all it has to meet these requirements:
|
|||
1. Regardless if the code introduces new features or fixes bugs or regressions, it must have comprehensive tests.
|
||||
1. The code must be well documented in the Lightbend's standard documentation format (see the ‘Documentation’ section below).
|
||||
1. The commit messages must properly describe the changes, see further below.
|
||||
1. A pull request must indicate (link to) the issue it is aimed to resolve in the description (or comments) of the PR, in order to establish a link between PR and Issue. This can be achieved by writing "Fixes #1234" or similar in PR description.
|
||||
1. All Lightbend projects must include Lightbend copyright notices. Each project can choose between one of two approaches:
|
||||
|
||||
1. All source files in the project must have a Lightbend copyright notice in the file header.
|
||||
|
|
|
|||
47
akka-actor/src/main/scala/akka/util/ConstantFun.scala
Normal file
47
akka-actor/src/main/scala/akka/util/ConstantFun.scala
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Copyright (C) 2015-2017 Lightbend Inc. <http://www.lightbend.com>
|
||||
*/
|
||||
package akka.util
|
||||
|
||||
import akka.annotation.InternalApi
|
||||
import akka.japi.function.{ Function ⇒ JFun, Function2 ⇒ JFun2 }
|
||||
import akka.japi.{ Pair ⇒ JPair }
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
@InternalApi private[akka] object ConstantFun {
|
||||
private[this] val JavaIdentityFunction = new JFun[Any, Any] {
|
||||
@throws(classOf[Exception]) override def apply(param: Any): Any = param
|
||||
}
|
||||
|
||||
val JavaPairFunction = new JFun2[AnyRef, AnyRef, AnyRef JPair AnyRef] {
|
||||
def apply(p1: AnyRef, p2: AnyRef): AnyRef JPair AnyRef = JPair(p1, p2)
|
||||
}
|
||||
|
||||
def javaCreatePairFunction[A, B]: JFun2[A, B, JPair[A, B]] = JavaPairFunction.asInstanceOf[JFun2[A, B, JPair[A, B]]]
|
||||
|
||||
def javaIdentityFunction[T]: JFun[T, T] = JavaIdentityFunction.asInstanceOf[JFun[T, T]]
|
||||
|
||||
def scalaIdentityFunction[T]: T ⇒ T = conforms.asInstanceOf[Function[T, T]]
|
||||
|
||||
def scalaAnyToNone[A, B]: A ⇒ Option[B] = none
|
||||
def scalaAnyTwoToNone[A, B, C]: (A, B) ⇒ Option[C] = two2none
|
||||
def javaAnyToNone[A, B]: A ⇒ Option[B] = none
|
||||
def nullFun[T] = _nullFun.asInstanceOf[Any ⇒ T]
|
||||
|
||||
val zeroLong = (_: Any) ⇒ 0L
|
||||
|
||||
val oneLong = (_: Any) ⇒ 1L
|
||||
|
||||
val oneInt = (_: Any) ⇒ 1
|
||||
|
||||
private val _nullFun = (_: Any) ⇒ null
|
||||
|
||||
private val conforms = (a: Any) ⇒ a
|
||||
|
||||
private val none = (_: Any) ⇒ None
|
||||
|
||||
private val two2none = (_: Any, _: Any) ⇒ None
|
||||
|
||||
}
|
||||
|
|
@ -8,11 +8,11 @@ import java.util.concurrent.TimeUnit
|
|||
import akka.NotUsed
|
||||
import akka.actor.ActorSystem
|
||||
import akka.stream.scaladsl._
|
||||
import akka.util.ConstantFun
|
||||
import org.openjdk.jmh.annotations._
|
||||
import scala.concurrent.Await
|
||||
import scala.concurrent.duration._
|
||||
import scala.concurrent.Future
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.Done
|
||||
|
||||
object MaterializationBenchmark {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*/
|
||||
package akka.stream.tck
|
||||
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.stream.scaladsl.Sink
|
||||
import akka.stream.scaladsl.Source
|
||||
import akka.util.ConstantFun
|
||||
import org.reactivestreams.Publisher
|
||||
|
||||
class FlattenTest extends AkkaPublisherVerification[Int] {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import akka.japi.JavaPartialFunction;
|
|||
import akka.japi.Pair;
|
||||
import akka.japi.function.*;
|
||||
import akka.stream.*;
|
||||
import akka.stream.impl.ConstantFun;
|
||||
import akka.util.ConstantFun;
|
||||
import akka.stream.javadsl.GraphDSL.Builder;
|
||||
import akka.stream.stage.*;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import akka.japi.Pair;
|
|||
import akka.japi.function.*;
|
||||
import akka.japi.pf.PFBuilder;
|
||||
import akka.stream.*;
|
||||
import akka.stream.impl.ConstantFun;
|
||||
import akka.util.ConstantFun;
|
||||
import akka.stream.stage.*;
|
||||
import akka.testkit.AkkaSpec;
|
||||
import akka.stream.testkit.TestPublisher;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
package akka.stream.impl.fusing
|
||||
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.stream.stage._
|
||||
import akka.stream.testkit.StreamSpec
|
||||
import akka.testkit.EventFilter
|
||||
import akka.stream._
|
||||
import akka.stream.impl.fusing.GraphStages.SimpleLinearGraphStage
|
||||
import akka.util.ConstantFun
|
||||
|
||||
class InterpreterSpec extends StreamSpec with GraphInterpreterSpecKit {
|
||||
import Supervision.stoppingDecider
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
package akka.stream.impl.fusing
|
||||
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.stream.Supervision
|
||||
import akka.stream.testkit.StreamSpec
|
||||
import akka.testkit.LongRunningTest
|
||||
import akka.util.ConstantFun
|
||||
|
||||
class InterpreterStressSpec extends StreamSpec with GraphInterpreterSpecKit {
|
||||
import Supervision.stoppingDecider
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package akka.stream.scaladsl
|
||||
|
||||
import akka.NotUsed
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.util.ConstantFun
|
||||
|
||||
import scala.util.control.NoStackTrace
|
||||
import akka.stream.ActorMaterializer
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import akka.japi.{ Pair ⇒ JPair }
|
|||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
@deprecated("Use akka.util.ConstantFun instead", "2.5.0")
|
||||
@InternalApi private[akka] object ConstantFun {
|
||||
private[this] val JavaIdentityFunction = new JFun[Any, Any] {
|
||||
@throws(classOf[Exception]) override def apply(param: Any): Any = param
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
*/
|
||||
package akka.stream.javadsl
|
||||
|
||||
import akka.util.ConstantFun
|
||||
import akka.{ Done, NotUsed }
|
||||
import akka.event.LoggingAdapter
|
||||
import akka.japi.{ Pair, function }
|
||||
import akka.stream.impl.{ ConstantFun, StreamLayout }
|
||||
import akka.stream.impl.StreamLayout
|
||||
import akka.stream._
|
||||
import org.reactivestreams.Processor
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ package akka.stream.javadsl
|
|||
import akka.NotUsed
|
||||
import akka.stream._
|
||||
import akka.japi.{ Pair, function }
|
||||
import akka.util.ConstantFun
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
import akka.stream.impl.ConstantFun
|
||||
|
||||
/**
|
||||
* Merge several streams, taking elements as they arrive from input streams
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ package akka.stream.javadsl
|
|||
import java.util
|
||||
import java.util.Optional
|
||||
|
||||
import akka.util.ConstantFun
|
||||
import akka.{ Done, NotUsed }
|
||||
import akka.actor.{ ActorRef, Cancellable, Props }
|
||||
import akka.event.LoggingAdapter
|
||||
import akka.japi.{ Pair, Util, function }
|
||||
import akka.stream._
|
||||
import akka.stream.impl.{ ConstantFun, LinearTraversalBuilder, SourceQueueAdapter, StreamLayout }
|
||||
import akka.stream.impl.{ LinearTraversalBuilder, SourceQueueAdapter, StreamLayout }
|
||||
import org.reactivestreams.{ Publisher, Subscriber }
|
||||
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import akka.NotUsed
|
|||
import akka.event.LoggingAdapter
|
||||
import akka.japi.function
|
||||
import akka.stream._
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.util.ConstantFun
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import akka.NotUsed
|
|||
import akka.event.LoggingAdapter
|
||||
import akka.japi.function
|
||||
import akka.stream._
|
||||
import akka.stream.impl.ConstantFun
|
||||
import akka.util.ConstantFun
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import akka.Done
|
|||
import akka.stream.impl._
|
||||
import akka.stream.impl.fusing._
|
||||
import akka.stream.stage._
|
||||
import akka.util.ConstantFun
|
||||
import org.reactivestreams.{ Processor, Publisher, Subscriber, Subscription }
|
||||
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import akka.stream.impl.fusing.GraphStages
|
|||
import akka.stream.impl.Stages.DefaultAttributes
|
||||
import akka.stream.scaladsl.Partition.PartitionOutOfBoundsException
|
||||
import akka.stream.stage.{ GraphStage, GraphStageLogic, InHandler, OutHandler }
|
||||
import akka.util.ConstantFun
|
||||
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
import scala.annotation.tailrec
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
package akka.stream.scaladsl
|
||||
|
||||
import akka.stream.impl.Stages.DefaultAttributes
|
||||
import akka.util.ConstantFun
|
||||
import akka.{ Done, NotUsed }
|
||||
import akka.actor.{ ActorRef, Cancellable, Props }
|
||||
import akka.stream.actor.ActorPublisher
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ addSbtPlugin("pl.project13.sbt" % "sbt-jol" % "0.1.1")
|
|||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1")
|
||||
|
||||
// for advanced PR validation features
|
||||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.0")
|
||||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
|
||||
|
||||
libraryDependencies += "org.kohsuke" % "github-api" % "1.68"
|
||||
|
||||
addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.6.0")
|
||||
|
||||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.8")
|
||||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")
|
||||
|
||||
resolvers += Resolver.url("2m-sbt-plugin-releases", url("https://dl.bintray.com/2m/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
|
||||
resolvers += Resolver.bintrayRepo("2m", "sbt-plugin-releases")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue