Various scala-2.13.0-M5 fixes
fix akka-actor-tests compile errors some tests still fail though Fix test failures in akka-actor-test Manually work arround missing implicit Factory[Nothing, Seq[Nothing]] see https://github.com/scala/scala-collection-compat/issues/137 akka-remote scalafix changes Fix shutdownAll compile error test:akka-remote scalafix changes akka-multi-node-testkit scalafix Fix akka-remote-tests multi-jvm compile errors akka-stream-tests/test:scalafix Fix test:akka-stream-tests Crude implementation of ByteString.map scalafix akka-actor-typed, akka-actor-typed-tests akka-actor-typed-tests compile and succeed scalafix akka-camel scalafix akka-cluster akka-cluster compile & test scalafix akka-cluster-metrics Fix akka-cluster-metrics scalafix akka-cluster-tools akka-cluster-tools compile and test scalafix akka-distributed-data akka-distributed-data fixes scalafix akka-persistence scalafix akka-cluster-sharding fix akka-cluster-sharding scalafix akka-contrib Fix akka-cluster-sharding-typed test scalafix akka-docs Use scala-stm 0.9 (released for M5) akka-docs Remove dependency on collections-compat Cherry-pick the relevant constructs to our own private utils Shorten 'scala.collections.immutable' by importing it Duplicate 'immutable' imports Use 'foreach' on futures Replace MapLike with regular Map Internal API markers Simplify ccompat by moving PackageShared into object Since we don't currently need to differentiate between 2.11 and Avoid relying on 'union' (and ++) being left-biased Fix akka-actor/doc by removing -Ywarn-unused Make more things more private Copyright headers Use 'unsorted' to go from SortedSet to Set Duplicate import Use onComplete rather than failed.foreach Clarify why we partly duplicate scala-collection-compat
This commit is contained in:
parent
3bff646218
commit
d274e039f9
141 changed files with 596 additions and 468 deletions
|
|
@ -449,40 +449,17 @@ class FutureDocSpec extends AkkaSpec {
|
|||
Await.result(future4, 3 seconds) should be("foo")
|
||||
}
|
||||
|
||||
"demonstrate usage of onSuccess & onFailure & onComplete" in {
|
||||
{
|
||||
val future = Future { "foo" }
|
||||
//#onSuccess
|
||||
future onSuccess {
|
||||
case "bar" ⇒ println("Got my bar alright!")
|
||||
case x: String ⇒ println("Got some random string: " + x)
|
||||
}
|
||||
//#onSuccess
|
||||
Await.result(future, 3 seconds) should be("foo")
|
||||
}
|
||||
{
|
||||
val future = Future.failed[String](new IllegalStateException("OHNOES"))
|
||||
//#onFailure
|
||||
future onFailure {
|
||||
case ise: IllegalStateException if ise.getMessage == "OHNOES" ⇒
|
||||
//OHNOES! We are in deep trouble, do something!
|
||||
case e: Exception ⇒
|
||||
//Do something else
|
||||
}
|
||||
//#onFailure
|
||||
}
|
||||
{
|
||||
val future = Future { "foo" }
|
||||
def doSomethingOnSuccess(r: String) = ()
|
||||
def doSomethingOnFailure(t: Throwable) = ()
|
||||
//#onComplete
|
||||
future onComplete {
|
||||
case Success(result) ⇒ doSomethingOnSuccess(result)
|
||||
case Failure(failure) ⇒ doSomethingOnFailure(failure)
|
||||
}
|
||||
//#onComplete
|
||||
Await.result(future, 3 seconds) should be("foo")
|
||||
"demonstrate usage of onComplete" in {
|
||||
val future = Future { "foo" }
|
||||
def doSomethingOnSuccess(r: String) = ()
|
||||
def doSomethingOnFailure(t: Throwable) = ()
|
||||
//#onComplete
|
||||
future onComplete {
|
||||
case Success(result) ⇒ doSomethingOnSuccess(result)
|
||||
case Failure(failure) ⇒ doSomethingOnFailure(failure)
|
||||
}
|
||||
//#onComplete
|
||||
Await.result(future, 3 seconds) should be("foo")
|
||||
}
|
||||
|
||||
"demonstrate usage of Future.successful & Future.failed & Future.promise" in {
|
||||
|
|
@ -528,7 +505,7 @@ class FutureDocSpec extends AkkaSpec {
|
|||
}
|
||||
//Return a new future that will retry up to 10 times
|
||||
val retried = akka.pattern.retry(
|
||||
attempt,
|
||||
() ⇒ attempt(),
|
||||
10,
|
||||
100 milliseconds)
|
||||
//#retry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue