Update scala to 2.13.3 and silencer to 1.7.0 (#28991)

* Update scala to 2.13.3 and silencer to 1.7.0
* Also travis
* Fix various warnings
This commit is contained in:
Arnout Engelen 2020-08-10 12:54:38 +02:00 committed by GitHub
parent f7bfed02bc
commit c41c0420ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
113 changed files with 180 additions and 206 deletions

View file

@ -4,7 +4,7 @@ sudo: false
scala: scala:
- "2.12.11" - "2.12.11"
- "2.13.1" - "2.13.3"
before_install: curl -Ls https://git.io/jabba | bash && . ~/.jabba/jabba.sh before_install: curl -Ls https://git.io/jabba | bash && . ~/.jabba/jabba.sh
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version

View file

@ -216,14 +216,14 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing {
val testkit = BehaviorTestKit[Parent.Command](Parent.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildren(2)) testkit.run(SpawnChildren(2))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects should contain only (Spawned(Child.initial, "child0"), Spawned(Child.initial, "child1", Props.empty)) effects should contain.only(Spawned(Child.initial, "child0"), Spawned(Child.initial, "child1", Props.empty))
} }
"create children when props specified and record effects" in { "create children when props specified and record effects" in {
val testkit = BehaviorTestKit[Parent.Command](Parent.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildrenWithProps(2, props)) testkit.run(SpawnChildrenWithProps(2, props))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects should contain only (Spawned(Child.initial, "child0", props), Spawned(Child.initial, "child1", props)) effects should contain.only(Spawned(Child.initial, "child0", props), Spawned(Child.initial, "child1", props))
} }
} }
@ -316,7 +316,7 @@ class BehaviorTestKitSpec extends AnyWordSpec with Matchers with LogCapturing {
val d = TestInbox[Done]() val d = TestInbox[Done]()
testkit.run(KillSession(sessionRef, d.ref)) testkit.run(KillSession(sessionRef, d.ref))
d.receiveAll shouldBe Seq(Done) d.receiveAll() shouldBe Seq(Done)
testkit.expectEffectType[Stopped] testkit.expectEffectType[Stopped]
} }

View file

@ -41,7 +41,7 @@ class ActorConfigurationVerificationSpec
with BeforeAndAfterEach { with BeforeAndAfterEach {
import ActorConfigurationVerificationSpec._ import ActorConfigurationVerificationSpec._
override def atStartup: Unit = { override def atStartup(): Unit = {
system.eventStream.publish(Mute(EventFilter[ConfigurationException](""))) system.eventStream.publish(Mute(EventFilter[ConfigurationException]("")))
} }

View file

@ -93,7 +93,7 @@ class ActorWithBoundedStashSpec
with ImplicitSender { with ImplicitSender {
import ActorWithBoundedStashSpec._ import ActorWithBoundedStashSpec._
override def atStartup: Unit = { override def atStartup(): Unit = {
system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*received dead letter from.*hello.*"))) system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*received dead letter from.*hello.*")))
} }

View file

@ -34,7 +34,7 @@ object InstanceCountingExtension extends ExtensionId[InstanceCountingExtension]
override def createExtension(system: ExtendedActorSystem): InstanceCountingExtension = { override def createExtension(system: ExtendedActorSystem): InstanceCountingExtension = {
new InstanceCountingExtension new InstanceCountingExtension
} }
override def lookup(): ExtensionId[_ <: Extension] = this override def lookup: ExtensionId[_ <: Extension] = this
} }
class InstanceCountingExtension extends Extension { class InstanceCountingExtension extends Extension {

View file

@ -160,7 +160,7 @@ object SupervisorHierarchySpec {
def suspendCount = context.asInstanceOf[ActorCell].mailbox.suspendCount def suspendCount = context.asInstanceOf[ActorCell].mailbox.suspendCount
override def preStart: Unit = { override def preStart(): Unit = {
log :+= Event("started", identityHashCode(this)) log :+= Event("started", identityHashCode(this))
listener ! Ready(self) listener ! Ready(self)
val s = size - 1 // subtract myself val s = size - 1 // subtract myself
@ -258,7 +258,7 @@ object SupervisorHierarchySpec {
} }
} }
override def postStop: Unit = { override def postStop(): Unit = {
if (failed || suspended) { if (failed || suspended) {
listener ! ErrorLog("not resumed (" + failed + ", " + suspended + ")", log) listener ! ErrorLog("not resumed (" + failed + ", " + suspended + ")", log)
val state = stateCache.get(self) val state = stateCache.get(self)
@ -456,7 +456,7 @@ object SupervisorHierarchySpec {
throw ActorKilledException("I said I wanted to DIE, dammit!") throw ActorKilledException("I said I wanted to DIE, dammit!")
} }
override def postStop: Unit = { override def postStop(): Unit = {
testActor ! "stressTestStopped" testActor ! "stressTestStopped"
} }

View file

@ -48,9 +48,9 @@ object TypedActorSpec {
def hasNext = items != Nil def hasNext = items != Nil
def next: T = { def next(): T = {
@tailrec @tailrec
def findNext: T = { def findNext(): T = {
val currentItems = current.get val currentItems = current.get
val newItems = currentItems match { val newItems = currentItems match {
case Nil => items case Nil => items
@ -58,10 +58,10 @@ object TypedActorSpec {
} }
if (current.compareAndSet(currentItems, newItems.tail)) newItems.head if (current.compareAndSet(currentItems, newItems.tail)) newItems.head
else findNext else findNext()
} }
findNext findNext()
} }
override def exists(f: T => Boolean): Boolean = items.exists(f) override def exists(f: T => Boolean): Boolean = items.exists(f)
@ -122,7 +122,7 @@ object TypedActorSpec {
import akka.actor.TypedActor.dispatcher import akka.actor.TypedActor.dispatcher
def pigdog = "Pigdog" def pigdog() = "Pigdog"
def futurePigdog(): Future[String] = Future.successful(pigdog()) def futurePigdog(): Future[String] = Future.successful(pigdog())
@ -133,7 +133,7 @@ object TypedActorSpec {
def futurePigdog(delay: FiniteDuration, numbered: Int): Future[String] = { def futurePigdog(delay: FiniteDuration, numbered: Int): Future[String] = {
Thread.sleep(delay.toMillis) Thread.sleep(delay.toMillis)
Future.successful(pigdog + numbered) Future.successful(pigdog() + numbered)
} }
@silent @silent

View file

@ -208,9 +208,9 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
awaitCond(counter.get == 2) awaitCond(counter.get == 2)
perform(_ + 4) perform(_ + 4)
perform(_ * 2) perform(_ * 2)
sec.size should ===(2) sec.size() should ===(2)
Thread.sleep(500) Thread.sleep(500)
sec.size should ===(2) sec.size() should ===(2)
counter.get should ===(2) counter.get should ===(2)
sec.resume() sec.resume()
awaitCond(counter.get == 12) awaitCond(counter.get == 12)
@ -272,7 +272,7 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
} }
perform(x => { sec.suspend(); x * 2 }) perform(x => { sec.suspend(); x * 2 })
perform(_ + 8) perform(_ + 8)
sec.size should ===(13) sec.size() should ===(13)
sec.resume() sec.resume()
awaitCond(counter.get == 2) awaitCond(counter.get == 2)
sec.resume() sec.resume()

View file

@ -37,7 +37,7 @@ object ForkJoinPoolStarvationSpec {
override def receive = { override def receive = {
case "ping" => case "ping" =>
sender ! "All fine" sender() ! "All fine"
} }
} }

View file

@ -60,7 +60,7 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
expectMsg(DeadLetter(exampleMessage.message, system.deadLetters, testActor)) expectMsg(DeadLetter(exampleMessage.message, system.deadLetters, testActor))
system.eventStream.unsubscribe(testActor, classOf[DeadLetter]) system.eventStream.unsubscribe(testActor, classOf[DeadLetter])
q.dequeue should ===(exampleMessage) q.dequeue() should ===(exampleMessage)
q.numberOfMessages should ===(config.capacity - 1) q.numberOfMessages should ===(config.capacity - 1)
q.hasMessages should ===(true) q.hasMessages should ===(true)
} }
@ -98,7 +98,7 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
def ensureSingleConsumerEnqueueDequeue(config: MailboxType): Unit = { def ensureSingleConsumerEnqueueDequeue(config: MailboxType): Unit = {
val q = factory(config) val q = factory(config)
ensureMailboxSize(q, 0) ensureMailboxSize(q, 0)
q.dequeue should ===(null) q.dequeue() should ===(null)
for (i <- 1 to 100) { for (i <- 1 to 100) {
q.enqueue(testActor, exampleMessage) q.enqueue(testActor, exampleMessage)
ensureMailboxSize(q, i) ensureMailboxSize(q, i)
@ -111,7 +111,7 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
ensureMailboxSize(q, i) ensureMailboxSize(q, i)
} }
q.dequeue should ===(null) q.dequeue() should ===(null)
ensureMailboxSize(q, 0) ensureMailboxSize(q, 0)
} }

View file

@ -329,7 +329,7 @@ object LookupEventBusSpec {
override protected def classify(event: Int): String = event.toString override protected def classify(event: Int): String = event.toString
override protected def compareSubscribers(a: Procedure[Int], b: Procedure[Int]): Int = override protected def compareSubscribers(a: Procedure[Int], b: Procedure[Int]): Int =
akka.util.Helpers.compareIdentityHash(a, b) akka.util.Helpers.compareIdentityHash(a, b)
override protected def mapSize = 32 override protected def mapSize() = 32
override protected def publish(event: Int, subscriber: Procedure[Int]): Unit = override protected def publish(event: Int, subscriber: Procedure[Int]): Unit =
subscriber(event) subscriber(event)
} }

View file

@ -956,7 +956,7 @@ class TcpConnectionSpec extends AkkaSpec("""
override def run(body: => Unit): Unit = super.run { override def run(body: => Unit): Unit = super.run {
registerCallReceiver.expectMsg(Registration(clientSideChannel, 0)) registerCallReceiver.expectMsg(Registration(clientSideChannel, 0))
registerCallReceiver.sender should ===(connectionActor) registerCallReceiver.sender() should ===(connectionActor)
body body
} }
} }

View file

@ -123,9 +123,13 @@ class AsyncDnsResolverSpec extends AkkaSpec("""
r ! Resolve(name) r ! Resolve(name)
dnsClient1.expectNoMessage(50.millis) dnsClient1.expectNoMessage(50.millis)
val answer = senderProbe.expectMsgType[Resolved] val answer = senderProbe.expectMsgType[Resolved]
val Seq(AAAARecord("1:2:3:0:0:0:0:0", Ttl.effectivelyForever, _)) = answer.records.collect { val Seq(aaaaRecord) = answer.records.collect {
case r: AAAARecord => r case r: AAAARecord => r
} }
aaaaRecord.name should be("1:2:3:0:0:0:0:0")
aaaaRecord.ttl should be(Ttl.effectivelyForever)
// The leading '/' indicates no reverse lookup was performed
aaaaRecord.ip.toString should be("/1:2:3:0:0:0:0:0")
} }
"return additional records for SRV requests" in new Setup { "return additional records for SRV requests" in new Setup {

View file

@ -141,10 +141,10 @@ class BackoffOnRestartSupervisorSpec extends AkkaSpec("""
class SlowlyFailingActor(latch: CountDownLatch) extends Actor { class SlowlyFailingActor(latch: CountDownLatch) extends Actor {
def receive: Receive = { def receive: Receive = {
case "THROW" => case "THROW" =>
sender ! "THROWN" sender() ! "THROWN"
throw new NormalException throw new NormalException
case "PING" => case "PING" =>
sender ! "PONG" sender() ! "PONG"
} }
override def postStop(): Unit = { override def postStop(): Unit = {

View file

@ -44,7 +44,7 @@ class PipeToSpec extends AkkaSpec {
"work in Java form with sender()" in { "work in Java form with sender()" in {
val p = TestProbe() val p = TestProbe()
pipe(Future(42)) to (p.ref, testActor) pipe(Future(42)).to(p.ref, testActor)
p.expectMsg(42) p.expectMsg(42)
p.lastSender should ===(testActor) p.lastSender should ===(testActor)
} }
@ -86,7 +86,7 @@ class PipeToSpec extends AkkaSpec {
"work in Java form with sender()" in { "work in Java form with sender()" in {
val p = TestProbe() val p = TestProbe()
val sel = system.actorSelection(p.ref.path) val sel = system.actorSelection(p.ref.path)
pipe(Future(42)) to (sel, testActor) pipe(Future(42)).to(sel, testActor)
p.expectMsg(42) p.expectMsg(42)
p.lastSender should ===(testActor) p.lastSender should ===(testActor)
} }

View file

@ -22,7 +22,6 @@ import akka.pattern.gracefulStop
import akka.testkit.{ AkkaSpec, DefaultTimeout, ImplicitSender } import akka.testkit.{ AkkaSpec, DefaultTimeout, ImplicitSender }
import akka.testkit.TestActors.echoActorProps import akka.testkit.TestActors.echoActorProps
import akka.testkit.TestProbe import akka.testkit.TestProbe
import akka.testkit.TestProbe
object ConfiguredLocalRoutingSpec { object ConfiguredLocalRoutingSpec {
val config = """ val config = """

View file

@ -71,7 +71,7 @@ object MetricsBasedResizerSpec {
class MetricsBasedResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with ImplicitSender { class MetricsBasedResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with ImplicitSender {
override def atStartup: Unit = { override def atStartup(): Unit = {
// when shutting down some Resize messages might hang around // when shutting down some Resize messages might hang around
system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*Resize"))) system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*Resize")))
} }

View file

@ -41,7 +41,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
import akka.routing.ResizerSpec._ import akka.routing.ResizerSpec._
override def atStartup: Unit = { override def atStartup(): Unit = {
// when shutting down some Resize messages might hang around // when shutting down some Resize messages might hang around
system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*Resize"))) system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*Resize")))
} }

View file

@ -25,7 +25,7 @@ object TailChoppingSpec {
case _ => case _ =>
times += 1 times += 1
Thread.sleep(sleepTime.toMillis) Thread.sleep(sleepTime.toMillis)
sender ! "ack" sender() ! "ack"
} }
}), "Actor:" + id) }), "Actor:" + id)
} }

View file

@ -187,13 +187,13 @@ class AskSpec extends ScalaTestWithActorTestKit("""
"askWithStatus pattern" must { "askWithStatus pattern" must {
"unwrap nested response a successful response" in { "unwrap nested response a successful response" in {
val probe = createTestProbe[Request] val probe = createTestProbe[Request]()
val result: Future[String] = probe.ref.askWithStatus(Request(_)) val result: Future[String] = probe.ref.askWithStatus(Request(_))
probe.expectMessageType[Request].replyTo ! StatusReply.success("goodie") probe.expectMessageType[Request].replyTo ! StatusReply.success("goodie")
result.futureValue should ===("goodie") result.futureValue should ===("goodie")
} }
"fail future for a fail response with text" in { "fail future for a fail response with text" in {
val probe = createTestProbe[Request] val probe = createTestProbe[Request]()
val result: Future[String] = probe.ref.askWithStatus(Request(_)) val result: Future[String] = probe.ref.askWithStatus(Request(_))
probe.expectMessageType[Request].replyTo ! StatusReply.error("boom") probe.expectMessageType[Request].replyTo ! StatusReply.error("boom")
val exception = result.failed.futureValue val exception = result.failed.futureValue
@ -201,7 +201,7 @@ class AskSpec extends ScalaTestWithActorTestKit("""
exception.getMessage should ===("boom") exception.getMessage should ===("boom")
} }
"fail future for a fail response with custom exception" in { "fail future for a fail response with custom exception" in {
val probe = createTestProbe[Request] val probe = createTestProbe[Request]()
val result: Future[String] = probe.ref.askWithStatus(Request(_)) val result: Future[String] = probe.ref.askWithStatus(Request(_))
probe.expectMessageType[Request].replyTo ! StatusReply.error(TestException("boom")) probe.expectMessageType[Request].replyTo ! StatusReply.error(TestException("boom"))
val exception = result.failed.futureValue val exception = result.failed.futureValue

View file

@ -80,7 +80,7 @@ class FSMDocSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with Log
"FSMDocSpec" must { "FSMDocSpec" must {
"work" in { "work" in {
val buncher = spawn(Buncher()) val buncher = spawn(Buncher())
val probe = TestProbe[Buncher.Batch] val probe = TestProbe[Buncher.Batch]()
buncher ! Buncher.SetTarget(probe.ref) buncher ! Buncher.SetTarget(probe.ref)
buncher ! Buncher.Queue(42) buncher ! Buncher.Queue(42)
buncher ! Buncher.Queue(43) buncher ! Buncher.Queue(43)

View file

@ -8,7 +8,6 @@ import akka.actor.testkit.typed.scaladsl.LogCapturing
import akka.actor.typed._ import akka.actor.typed._
import akka.actor.typed.scaladsl.Behaviors import akka.actor.typed.scaladsl.Behaviors
import akka.testkit.TestKit import akka.testkit.TestKit
import docs.akka.typed.coexistence.TypedWatchingClassicSpec.Typed
//#adapter-import //#adapter-import
// adds support for typed actors to a classic actor system and context // adds support for typed actors to a classic actor system and context
import akka.actor.typed.scaladsl.adapter._ import akka.actor.typed.scaladsl.adapter._

View file

@ -21,7 +21,7 @@ import akka.actor.typed.internal.adapter.ActorSystemAdapter
import akka.annotation.InternalApi import akka.annotation.InternalApi
import akka.dispatch.ExecutionContexts import akka.dispatch.ExecutionContexts
import akka.pattern.StatusReply import akka.pattern.StatusReply
import akka.util.{ BoxedType, Timeout } import akka.util.BoxedType
import akka.util.JavaDurationConverters._ import akka.util.JavaDurationConverters._
import akka.util.OptionVal import akka.util.OptionVal
import akka.util.Timeout import akka.util.Timeout

View file

@ -137,7 +137,7 @@ private[akka] object ActorSystemAdapter {
object AdapterExtension extends classic.ExtensionId[AdapterExtension] with classic.ExtensionIdProvider { object AdapterExtension extends classic.ExtensionId[AdapterExtension] with classic.ExtensionIdProvider {
override def get(system: classic.ActorSystem): AdapterExtension = super.get(system) override def get(system: classic.ActorSystem): AdapterExtension = super.get(system)
override def lookup() = AdapterExtension override def lookup = AdapterExtension
override def createExtension(system: classic.ExtendedActorSystem): AdapterExtension = override def createExtension(system: classic.ExtendedActorSystem): AdapterExtension =
new AdapterExtension(system) new AdapterExtension(system)
} }
@ -154,7 +154,7 @@ private[akka] object ActorSystemAdapter {
} }
object LoadTypedExtensions extends classic.ExtensionId[LoadTypedExtensions] with classic.ExtensionIdProvider { object LoadTypedExtensions extends classic.ExtensionId[LoadTypedExtensions] with classic.ExtensionIdProvider {
override def lookup(): actor.ExtensionId[_ <: actor.Extension] = this override def lookup: actor.ExtensionId[_ <: actor.Extension] = this
override def createExtension(system: ExtendedActorSystem): LoadTypedExtensions = override def createExtension(system: ExtendedActorSystem): LoadTypedExtensions =
new LoadTypedExtensions(system) new LoadTypedExtensions(system)
} }

View file

@ -1347,7 +1347,7 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {
_tempLength = 0 _tempLength = 0
} }
def result: ByteString = def result(): ByteString =
if (_length == 0) ByteString.empty if (_length == 0) ByteString.empty
else { else {
clearTemp() clearTemp()

View file

@ -14,7 +14,6 @@ import scala.concurrent.Future
import scala.concurrent.Promise import scala.concurrent.Promise
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.language.implicitConversions import scala.language.implicitConversions
import scala.language.implicitConversions
import scala.util.Success import scala.util.Success
import com.github.ghik.silencer.silent import com.github.ghik.silencer.silent

View file

@ -1185,7 +1185,7 @@ private[akka] class ActorSystemImpl(
dynamicAccess.createInstanceFor[AnyRef](fqcn, Nil).recoverWith { case _ => Failure(firstProblem) } dynamicAccess.createInstanceFor[AnyRef](fqcn, Nil).recoverWith { case _ => Failure(firstProblem) }
} match { } match {
case Success(p: ExtensionIdProvider) => case Success(p: ExtensionIdProvider) =>
registerExtension(p.lookup()) registerExtension(p.lookup)
case Success(p: ExtensionId[_]) => case Success(p: ExtensionId[_]) =>
registerExtension(p) registerExtension(p)
case Success(_) => case Success(_) =>

View file

@ -244,7 +244,8 @@ private[akka] class Deployer(val settings: ActorSystem.Settings, val dynamicAcce
def lookup(path: Iterable[String]): Option[Deploy] = deployments.get().find(path) def lookup(path: Iterable[String]): Option[Deploy] = deployments.get().find(path)
def deploy(d: Deploy): Unit = { def deploy(d: Deploy): Unit = {
@tailrec def add(path: Array[String], d: Deploy, w: WildcardIndex[Deploy] = deployments.get): Unit = { @tailrec def add(path: Array[String], d: Deploy): Unit = {
val w: WildcardIndex[Deploy] = deployments.get
for (i <- path.indices) path(i) match { for (i <- path.indices) path(i) match {
case "" => throw InvalidActorNameException(s"Actor name in deployment [${d.path}] must not be empty") case "" => throw InvalidActorNameException(s"Actor name in deployment [${d.path}] must not be empty")
case el => ActorPath.validatePathElement(el, fullPath = d.path) case el => ActorPath.validatePathElement(el, fullPath = d.path)

View file

@ -132,5 +132,5 @@ trait ExtensionIdProvider {
/** /**
* Returns the canonical ExtensionId for this Extension * Returns the canonical ExtensionId for this Extension
*/ */
def lookup(): ExtensionId[_ <: Extension] def lookup: ExtensionId[_ <: Extension]
} }

View file

@ -11,7 +11,6 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.util.control.NoStackTrace import scala.util.control.NoStackTrace
import com.github.ghik.silencer.silent
import com.github.ghik.silencer.silent import com.github.ghik.silencer.silent
import akka.annotation.InternalApi import akka.annotation.InternalApi

View file

@ -110,7 +110,7 @@ object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvi
override def get(system: ActorSystem): TypedActorExtension = super.get(system) override def get(system: ActorSystem): TypedActorExtension = super.get(system)
override def get(system: ClassicActorSystemProvider): TypedActorExtension = super.get(system) override def get(system: ClassicActorSystemProvider): TypedActorExtension = super.get(system)
def lookup() = this def lookup = this
def createExtension(system: ExtendedActorSystem): TypedActorExtension = new TypedActorExtension(system) def createExtension(system: ExtendedActorSystem): TypedActorExtension = new TypedActorExtension(system)
/** /**

View file

@ -106,7 +106,7 @@ class Dispatcher(
/** /**
* INTERNAL API * INTERNAL API
*/ */
protected[akka] def shutdown: Unit = { protected[akka] def shutdown(): Unit = {
val newDelegate = executorServiceDelegate.copy() // Doesn't matter which one we copy val newDelegate = executorServiceDelegate.copy() // Doesn't matter which one we copy
val es = esUpdater.getAndSet(this, newDelegate) val es = esUpdater.getAndSet(this, newDelegate)
es.shutdown() es.shutdown()

View file

@ -50,7 +50,7 @@ abstract class LookupEventBus[E, S, C] extends EventBus[E, S, C] {
type Subscriber = S type Subscriber = S
type Classifier = C type Classifier = C
override protected def mapSize: Int = LookupEventBus.this.mapSize() override protected def mapSize(): Int = LookupEventBus.this.mapSize()
override protected def compareSubscribers(a: S, b: S): Int = override protected def compareSubscribers(a: S, b: S): Int =
LookupEventBus.this.compareSubscribers(a, b) LookupEventBus.this.compareSubscribers(a, b)

View file

@ -137,7 +137,7 @@ object Dns extends ExtensionId[DnsExt] with ExtensionIdProvider {
Dns(system).cache.resolve(name, system, sender) Dns(system).cache.resolve(name, system, sender)
} }
override def lookup() = Dns override def lookup = Dns
override def createExtension(system: ExtendedActorSystem): DnsExt = new DnsExt(system) override def createExtension(system: ExtendedActorSystem): DnsExt = new DnsExt(system)

View file

@ -415,9 +415,9 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha
throw new IllegalStateException("Restarting not supported for connection actors.") throw new IllegalStateException("Restarting not supported for connection actors.")
def PendingWrite(commander: ActorRef, write: WriteCommand): PendingWrite = { def PendingWrite(commander: ActorRef, write: WriteCommand): PendingWrite = {
@tailrec def create(head: WriteCommand, tail: WriteCommand = Write.empty): PendingWrite = @tailrec def create(head: WriteCommand, tail: WriteCommand): PendingWrite =
head match { head match {
case Write.empty => if (tail eq Write.empty) EmptyPendingWrite else create(tail) case Write.empty => if (tail eq Write.empty) EmptyPendingWrite else create(tail, Write.empty)
case Write(data, ack) if data.nonEmpty => PendingBufferWrite(commander, data, ack, tail) case Write(data, ack) if data.nonEmpty => PendingBufferWrite(commander, data, ack, tail)
case WriteFile(path, offset, count, ack) => case WriteFile(path, offset, count, ack) =>
PendingWriteFile(commander, Paths.get(path), offset, count, ack, tail) PendingWriteFile(commander, Paths.get(path), offset, count, ack, tail)
@ -426,9 +426,9 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha
case CompoundWrite(h, t) => create(h, t) case CompoundWrite(h, t) => create(h, t)
case x @ Write(_, ack) => // empty write with either an ACK or a non-standard NoACK case x @ Write(_, ack) => // empty write with either an ACK or a non-standard NoACK
if (x.wantsAck) commander ! ack if (x.wantsAck) commander ! ack
create(tail) create(tail, Write.empty)
} }
create(write) create(write, Write.empty)
} }
def PendingBufferWrite(commander: ActorRef, data: ByteString, ack: Event, tail: WriteCommand): PendingBufferWrite = { def PendingBufferWrite(commander: ActorRef, data: ByteString, ack: Event, tail: WriteCommand): PendingBufferWrite = {

View file

@ -63,7 +63,7 @@ import akka.util.ByteString
context.become(ready(connection, data)) context.become(ready(connection, data))
else { else {
answerRecipient ! parseResponse(data.drop(prefixSize)) answerRecipient ! parseResponse(data.drop(prefixSize))
context.become(ready(connection)) context.become(ready(connection, ByteString.empty))
if (data.length > prefixSize + expectedPayloadLength) { if (data.length > prefixSize + expectedPayloadLength) {
self ! Tcp.Received(data.drop(prefixSize + expectedPayloadLength)) self ! Tcp.Received(data.drop(prefixSize + expectedPayloadLength))
} }

View file

@ -45,7 +45,7 @@ object ManifestInfo extends ExtensionId[ManifestInfo] with ExtensionIdProvider {
override def get(system: ActorSystem): ManifestInfo = super.get(system) override def get(system: ActorSystem): ManifestInfo = super.get(system)
override def get(system: ClassicActorSystemProvider): ManifestInfo = super.get(system) override def get(system: ClassicActorSystemProvider): ManifestInfo = super.get(system)
override def lookup(): ManifestInfo.type = ManifestInfo override def lookup: ManifestInfo.type = ManifestInfo
override def createExtension(system: ExtendedActorSystem): ManifestInfo = new ManifestInfo(system) override def createExtension(system: ExtendedActorSystem): ManifestInfo = new ManifestInfo(system)

View file

@ -102,7 +102,7 @@ object TellOnlyBenchmark {
def receive = { def receive = {
case `stop` => case `stop` =>
context.stop(self) context.stop(self)
case m => sender ! m case m => sender() ! m
} }
} }

View file

@ -8,7 +8,6 @@ import java.io.File
import scala.concurrent.Await import scala.concurrent.Await
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.concurrent.duration._
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import org.openjdk.jmh.annotations._ import org.openjdk.jmh.annotations._

View file

@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._ import org.openjdk.jmh.annotations._
import akka.event._ import akka.event._
import akka.stream.impl.fusing.{ GraphInterpreterSpecKit, GraphStages } import akka.stream.impl.fusing.GraphInterpreterSpecKit
import akka.stream.impl.fusing.GraphInterpreter.{ DownstreamBoundaryStageLogic, UpstreamBoundaryStageLogic } import akka.stream.impl.fusing.GraphInterpreter.{ DownstreamBoundaryStageLogic, UpstreamBoundaryStageLogic }
import akka.stream.impl.fusing.GraphStages import akka.stream.impl.fusing.GraphStages
import akka.stream.stage._ import akka.stream.stage._

View file

@ -200,7 +200,7 @@ private[metrics] class ClusterMetricsCollector extends Actor with ActorLogging {
} }
override def postStop: Unit = { override def postStop(): Unit = {
cluster.unsubscribe(self) cluster.unsubscribe(self)
gossipTask.cancel() gossipTask.cancel()
sampleTask.cancel() sampleTask.cancel()

View file

@ -96,8 +96,6 @@ abstract class ClusterShardingRememberEntitiesPerfSpec
import ClusterShardingRememberEntitiesPerfSpec._ import ClusterShardingRememberEntitiesPerfSpec._
import ClusterShardingRememberEntitiesPerfSpecConfig._ import ClusterShardingRememberEntitiesPerfSpecConfig._
import ClusterShardingRememberEntitiesPerfSpec._
def startSharding(): Unit = { def startSharding(): Unit = {
(1 to NrRegions).foreach { n => (1 to NrRegions).foreach { n =>
startSharding( startSharding(

View file

@ -812,7 +812,7 @@ private[akka] class ShardRegion(
} }
case msg: GetClusterShardingStats => case msg: GetClusterShardingStats =>
coordinator.fold(sender ! ClusterShardingStats(Map.empty))(_.forward(msg)) coordinator.fold(sender() ! ClusterShardingStats(Map.empty))(_.forward(msg))
case GetShardRegionState => case GetShardRegionState =>
replyToRegionStateQuery(sender()) replyToRegionStateQuery(sender())

View file

@ -13,7 +13,7 @@ import akka.util.FlightRecorderLoader
@InternalApi @InternalApi
object ShardingFlightRecorder extends ExtensionId[ShardingFlightRecorder] with ExtensionIdProvider { object ShardingFlightRecorder extends ExtensionId[ShardingFlightRecorder] with ExtensionIdProvider {
override def lookup(): ExtensionId[_ <: Extension] = this override def lookup: ExtensionId[_ <: Extension] = this
override def createExtension(system: ExtendedActorSystem): ShardingFlightRecorder = override def createExtension(system: ExtendedActorSystem): ShardingFlightRecorder =
FlightRecorderLoader.load[ShardingFlightRecorder]( FlightRecorderLoader.load[ShardingFlightRecorder](

View file

@ -48,7 +48,7 @@ object ExternalShardAllocation extends ExtensionId[ExternalShardAllocation] with
override def createExtension(system: ExtendedActorSystem): ExternalShardAllocation = override def createExtension(system: ExtendedActorSystem): ExternalShardAllocation =
new ExternalShardAllocation(system) new ExternalShardAllocation(system)
override def lookup(): ExternalShardAllocation.type = ExternalShardAllocation override def lookup: ExternalShardAllocation.type = ExternalShardAllocation
override def get(system: ClassicActorSystemProvider): ExternalShardAllocation = super.get(system) override def get(system: ClassicActorSystemProvider): ExternalShardAllocation = super.get(system)
} }

View file

@ -10,8 +10,6 @@ import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream import java.util.zip.GZIPOutputStream
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.concurrent.duration._
import akka.util.ccompat.JavaConverters._
import scala.collection.immutable import scala.collection.immutable
import scala.concurrent.duration._ import scala.concurrent.duration._
@ -34,7 +32,6 @@ import akka.serialization.BaseSerializer
import akka.serialization.Serialization import akka.serialization.Serialization
import akka.serialization.SerializerWithStringManifest import akka.serialization.SerializerWithStringManifest
import akka.util.ccompat._ import akka.util.ccompat._
import akka.util.ccompat.JavaConverters._ import akka.util.ccompat.JavaConverters._
/** /**

View file

@ -72,7 +72,7 @@ class PersistentStartEntitySpec
"remember entities started with StartEntity" in { "remember entities started with StartEntity" in {
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"startEntity", s"startEntity",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system) ClusterShardingSettings(system)
.withRememberEntities(true) .withRememberEntities(true)
.withStateStoreMode(ClusterShardingSettings.StateStoreModePersistence), .withStateStoreMode(ClusterShardingSettings.StateStoreModePersistence),

View file

@ -105,7 +105,7 @@ object RememberEntitiesFailureSpec {
override def receive: Receive = { override def receive: Receive = {
case RememberEntitiesShardStore.GetEntities => case RememberEntitiesShardStore.GetEntities =>
failShardGetEntities.get(shardId) match { failShardGetEntities.get(shardId) match {
case None => sender ! RememberEntitiesShardStore.RememberedEntities(Set.empty) case None => sender() ! RememberEntitiesShardStore.RememberedEntities(Set.empty)
case Some(NoResponse) => log.debug("Sending no response for GetEntities") case Some(NoResponse) => log.debug("Sending no response for GetEntities")
case Some(CrashStore) => throw TestException("store crash on GetEntities") case Some(CrashStore) => throw TestException("store crash on GetEntities")
case Some(StopStore) => context.stop(self) case Some(StopStore) => context.stop(self)
@ -115,7 +115,7 @@ object RememberEntitiesFailureSpec {
} }
case RememberEntitiesShardStore.Update(started, stopped) => case RememberEntitiesShardStore.Update(started, stopped) =>
failUpdate match { failUpdate match {
case None => sender ! RememberEntitiesShardStore.UpdateDone(started, stopped) case None => sender() ! RememberEntitiesShardStore.UpdateDone(started, stopped)
case Some(NoResponse) => log.debug("Sending no response for AddEntity") case Some(NoResponse) => log.debug("Sending no response for AddEntity")
case Some(CrashStore) => throw TestException("store crash on AddEntity") case Some(CrashStore) => throw TestException("store crash on AddEntity")
case Some(StopStore) => context.stop(self) case Some(StopStore) => context.stop(self)
@ -209,7 +209,7 @@ class RememberEntitiesFailureSpec
val probe = TestProbe() val probe = TestProbe()
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"initial-$wayToFail", s"initial-$wayToFail",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system).withRememberEntities(true), ClusterShardingSettings(system).withRememberEntities(true),
extractEntityId, extractEntityId,
extractShardId) extractShardId)
@ -238,7 +238,7 @@ class RememberEntitiesFailureSpec
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"shardStoreStart-$wayToFail", s"shardStoreStart-$wayToFail",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system).withRememberEntities(true), ClusterShardingSettings(system).withRememberEntities(true),
extractEntityId, extractEntityId,
extractShardId) extractShardId)
@ -280,7 +280,7 @@ class RememberEntitiesFailureSpec
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"shardStoreStopAbrupt-$wayToFail", s"shardStoreStopAbrupt-$wayToFail",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system).withRememberEntities(true), ClusterShardingSettings(system).withRememberEntities(true),
extractEntityId, extractEntityId,
extractShardId) extractShardId)
@ -316,7 +316,7 @@ class RememberEntitiesFailureSpec
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"shardStoreStopGraceful-$wayToFail", s"shardStoreStopGraceful-$wayToFail",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system).withRememberEntities(true), ClusterShardingSettings(system).withRememberEntities(true),
extractEntityId, extractEntityId,
extractShardId, extractShardId,
@ -357,7 +357,7 @@ class RememberEntitiesFailureSpec
val sharding = ClusterSharding(system).start( val sharding = ClusterSharding(system).start(
s"coordinatorStoreStopGraceful-$wayToFail", s"coordinatorStoreStopGraceful-$wayToFail",
Props[EntityActor], Props[EntityActor](),
ClusterShardingSettings(system).withRememberEntities(true), ClusterShardingSettings(system).withRememberEntities(true),
extractEntityId, extractEntityId,
extractShardId, extractShardId,

View file

@ -561,7 +561,7 @@ object ClusterClientReceptionist extends ExtensionId[ClusterClientReceptionist]
override def get(system: ActorSystem): ClusterClientReceptionist = super.get(system) override def get(system: ActorSystem): ClusterClientReceptionist = super.get(system)
override def get(system: ClassicActorSystemProvider): ClusterClientReceptionist = super.get(system) override def get(system: ClassicActorSystemProvider): ClusterClientReceptionist = super.get(system)
override def lookup() = ClusterClientReceptionist override def lookup = ClusterClientReceptionist
override def createExtension(system: ExtendedActorSystem): ClusterClientReceptionist = override def createExtension(system: ExtendedActorSystem): ClusterClientReceptionist =
new ClusterClientReceptionist(system) new ClusterClientReceptionist(system)

View file

@ -674,7 +674,7 @@ class DistributedPubSubMediator(settings: DistributedPubSubSettings)
forwardMessages(key, sender()) forwardMessages(key, sender())
case GetTopics => case GetTopics =>
sender ! CurrentTopics(getCurrentTopics()) sender() ! CurrentTopics(getCurrentTopics())
case Subscribed(ack, ref) => case Subscribed(ack, ref) =>
ref ! ack ref ! ack

View file

@ -28,7 +28,7 @@ object AttemptSysMsgRedeliveryMultiJvmSpec extends MultiNodeConfig {
class Echo extends Actor { class Echo extends Actor {
def receive = { def receive = {
case m => sender ! m case m => sender() ! m
} }
} }
} }

View file

@ -4,7 +4,6 @@
package akka.cluster package akka.cluster
import scala.concurrent.duration._
import scala.concurrent.duration._ import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory

View file

@ -48,7 +48,7 @@ object SurviveNetworkInstabilityMultiJvmSpec extends MultiNodeConfig {
class Echo extends Actor { class Echo extends Actor {
def receive = { def receive = {
case m => sender ! m case m => sender() ! m
} }
} }

View file

@ -59,7 +59,7 @@ class VectorClockPerfSpec extends AnyWordSpec with Matchers {
vc1.compareTo(vc2) should ===(order) vc1.compareTo(vc2) should ===(order)
} }
def !==(vc1: VectorClock, vc2: VectorClock): Unit = { def notEqual(vc1: VectorClock, vc2: VectorClock): Unit = {
vc1 == vc2 should ===(false) vc1 == vc2 should ===(false)
} }
@ -98,15 +98,15 @@ class VectorClockPerfSpec extends AnyWordSpec with Matchers {
} }
s"compare !== Before (middle) $iterations times" in { s"compare !== Before (middle) $iterations times" in {
checkThunkFor(vcBefore, vcBaseMiddle, !==, iterations) checkThunkFor(vcBefore, vcBaseMiddle, notEqual, iterations)
} }
s"compare !== After (middle) $iterations times" in { s"compare !== After (middle) $iterations times" in {
checkThunkFor(vcAfterMiddle, vcBaseMiddle, !==, iterations) checkThunkFor(vcAfterMiddle, vcBaseMiddle, notEqual, iterations)
} }
s"compare !== Concurrent (middle) $iterations times" in { s"compare !== Concurrent (middle) $iterations times" in {
checkThunkFor(vcAfterMiddle, vcConcurrentMiddle, !==, iterations) checkThunkFor(vcAfterMiddle, vcConcurrentMiddle, notEqual, iterations)
} }
} }

View file

@ -4,7 +4,7 @@
package akka.cluster.ddata.protobuf package akka.cluster.ddata.protobuf
import java.{ util, lang => jl } import java.{ lang => jl }
import java.io.NotSerializableException import java.io.NotSerializableException
import java.util import java.util
import java.util.ArrayList import java.util.ArrayList
@ -23,7 +23,7 @@ import akka.cluster.ddata.Replicator.Internal._
import akka.cluster.ddata.protobuf.msg.{ ReplicatedDataMessages => rd } import akka.cluster.ddata.protobuf.msg.{ ReplicatedDataMessages => rd }
import akka.cluster.ddata.protobuf.msg.{ ReplicatorMessages => dm } import akka.cluster.ddata.protobuf.msg.{ ReplicatorMessages => dm }
import akka.cluster.ddata.protobuf.msg.ReplicatorMessages.OtherMessage import akka.cluster.ddata.protobuf.msg.ReplicatorMessages.OtherMessage
import akka.protobufv3.internal.{ ByteString, GeneratedMessageV3 } import akka.protobufv3.internal.ByteString
import akka.protobufv3.internal.GeneratedMessageV3 import akka.protobufv3.internal.GeneratedMessageV3
import akka.serialization.BaseSerializer import akka.serialization.BaseSerializer
import akka.serialization.Serialization import akka.serialization.Serialization

View file

@ -24,7 +24,7 @@ class VersionVectorSpec
val node3 = UniqueAddress(node1.address.copy(port = Some(2553)), 3L) val node3 = UniqueAddress(node1.address.copy(port = Some(2553)), 3L)
val node4 = UniqueAddress(node1.address.copy(port = Some(2554)), 4L) val node4 = UniqueAddress(node1.address.copy(port = Some(2554)), 4L)
override def afterAll: Unit = { override def afterAll(): Unit = {
shutdown() shutdown()
} }

View file

@ -53,7 +53,7 @@ class ReplicatedDataSerializerSpec
val ref2 = system.actorOf(Props.empty, "ref2") val ref2 = system.actorOf(Props.empty, "ref2")
val ref3 = system.actorOf(Props.empty, "ref3") val ref3 = system.actorOf(Props.empty, "ref3")
override def afterAll: Unit = { override def afterAll(): Unit = {
shutdown() shutdown()
} }

View file

@ -54,7 +54,7 @@ class ReplicatorMessageSerializerSpec
val keyA = GSetKey[String]("A") val keyA = GSetKey[String]("A")
override def afterAll: Unit = { override def afterAll(): Unit = {
shutdown() shutdown()
} }

View file

@ -298,11 +298,11 @@ abstract class MultiNodeSpec(
def await: T = Await.result(w, remainingOr(testConductor.Settings.QueryTimeout.duration)) def await: T = Await.result(w, remainingOr(testConductor.Settings.QueryTimeout.duration))
} }
final override def multiNodeSpecBeforeAll: Unit = { final override def multiNodeSpecBeforeAll(): Unit = {
atStartup() atStartup()
} }
final override def multiNodeSpecAfterAll: Unit = { final override def multiNodeSpecAfterAll(): Unit = {
// wait for all nodes to remove themselves before we shut the conductor down // wait for all nodes to remove themselves before we shut the conductor down
if (selfIndex == 0) { if (selfIndex == 0) {
testConductor.removeNode(myself) testConductor.removeNode(myself)

View file

@ -21,7 +21,7 @@ class Activator extends ActorSystemActivator {
// optionally register the ActorSystem in the OSGi Service Registry // optionally register the ActorSystem in the OSGi Service Registry
registerService(context, system) registerService(context, system)
val someActor = system.actorOf(Props[SomeActor], name = "someName") val someActor = system.actorOf(Props[SomeActor](), name = "someName")
someActor ! SomeMessage someActor ! SomeMessage
} }

View file

@ -24,7 +24,7 @@ object PersistenceQuery extends ExtensionId[PersistenceQuery] with ExtensionIdPr
def createExtension(system: ExtendedActorSystem): PersistenceQuery = new PersistenceQuery(system) def createExtension(system: ExtendedActorSystem): PersistenceQuery = new PersistenceQuery(system)
def lookup(): PersistenceQuery.type = PersistenceQuery def lookup: PersistenceQuery.type = PersistenceQuery
@InternalApi @InternalApi
private[akka] val pluginProvider: PluginProvider[ReadJournalProvider, ReadJournal, javadsl.ReadJournal] = private[akka] val pluginProvider: PluginProvider[ReadJournalProvider, ReadJournal, javadsl.ReadJournal] =

View file

@ -41,7 +41,7 @@ trait MayVerb {
* @see <a href="https://www.rfc-editor.org/rfc/rfc2119.txt">RFC 2119</a> * @see <a href="https://www.rfc-editor.org/rfc/rfc2119.txt">RFC 2119</a>
*/ */
def may(right: => Unit)(implicit fun: StringVerbBlockRegistration, pos: Position): Unit = { def may(right: => Unit)(implicit fun: StringVerbBlockRegistration, pos: Position): Unit = {
fun(leftSideString, "may", pos, right _) fun(leftSideString, "may", pos, () => right)
} }
} }

View file

@ -24,6 +24,6 @@ private[testkit] object InMemStorageExtension extends ExtensionId[EventStorage]
new SimpleEventStorageImpl new SimpleEventStorageImpl
} }
override def lookup() = InMemStorageExtension override def lookup = InMemStorageExtension
} }

View file

@ -24,6 +24,6 @@ private[testkit] object SnapshotStorageEmulatorExtension extends ExtensionId[Sna
new SimpleSnapshotStorageImpl new SimpleSnapshotStorageImpl
} }
override def lookup(): ExtensionId[_ <: Extension] = override def lookup: ExtensionId[_ <: Extension] =
SnapshotStorageEmulatorExtension SnapshotStorageEmulatorExtension
} }

View file

@ -28,7 +28,6 @@ import akka.persistence.journal.inmem.InmemJournal
import akka.persistence.typed.EventRejectedException import akka.persistence.typed.EventRejectedException
import akka.persistence.typed.PersistenceId import akka.persistence.typed.PersistenceId
import akka.persistence.typed.RecoveryCompleted import akka.persistence.typed.RecoveryCompleted
import akka.persistence.typed.RecoveryCompleted
import akka.persistence.typed.RecoveryFailed import akka.persistence.typed.RecoveryFailed
import akka.persistence.typed.internal.JournalFailureException import akka.persistence.typed.internal.JournalFailureException

View file

@ -348,7 +348,7 @@ class EventSourcedBehaviorSpec
"adhere default and disabled Recovery strategies" in { "adhere default and disabled Recovery strategies" in {
val pid = nextPid() val pid = nextPid()
val probe = TestProbe[State] val probe = TestProbe[State]()
def counterWithRecoveryStrategy(recoveryStrategy: Recovery) = def counterWithRecoveryStrategy(recoveryStrategy: Recovery) =
Behaviors.setup[Command](counter(_, pid).withRecovery(recoveryStrategy)) Behaviors.setup[Command](counter(_, pid).withRecovery(recoveryStrategy))
@ -374,9 +374,9 @@ class EventSourcedBehaviorSpec
"adhere Recovery strategy with SnapshotSelectionCriteria" in { "adhere Recovery strategy with SnapshotSelectionCriteria" in {
val pid = nextPid() val pid = nextPid()
val eventProbe = TestProbe[(State, Event)] val eventProbe = TestProbe[(State, Event)]()
val commandProbe = TestProbe[State] val commandProbe = TestProbe[State]()
val snapshotProbe = TestProbe[Try[SnapshotMetadata]] val snapshotProbe = TestProbe[Try[SnapshotMetadata]]()
def counterWithSnapshotSelectionCriteria(recoveryStrategy: Recovery) = def counterWithSnapshotSelectionCriteria(recoveryStrategy: Recovery) =
Behaviors.setup[Command]( Behaviors.setup[Command](

View file

@ -11,7 +11,6 @@ import akka.actor.{ ActorPath, ActorSelection, NotInfluenceReceiveTimeout }
import akka.actor.Cancellable import akka.actor.Cancellable
import akka.actor.DeadLetterSuppression import akka.actor.DeadLetterSuppression
import akka.annotation.InternalApi import akka.annotation.InternalApi
import akka.persistence.AtLeastOnceDelivery.Internal.Delivery
import akka.persistence.serialization.Message import akka.persistence.serialization.Message
import akka.util.ccompat._ import akka.util.ccompat._

View file

@ -149,7 +149,7 @@ object Persistence extends ExtensionId[Persistence] with ExtensionIdProvider {
def createExtension(system: ExtendedActorSystem): Persistence = new Persistence(system) def createExtension(system: ExtendedActorSystem): Persistence = new Persistence(system)
def lookup() = Persistence def lookup = Persistence
/** INTERNAL API. */ /** INTERNAL API. */
private[persistence] case class PluginHolder(actorFactory: () => ActorRef, adapters: EventAdapters, config: Config) private[persistence] case class PluginHolder(actorFactory: () => ActorRef, adapters: EventAdapters, config: Config)

View file

@ -67,7 +67,7 @@ object PersistencePluginProxyExtension
with ExtensionIdProvider { with ExtensionIdProvider {
override def createExtension(system: ExtendedActorSystem): PersistencePluginProxyExtensionImpl = override def createExtension(system: ExtendedActorSystem): PersistencePluginProxyExtensionImpl =
new PersistencePluginProxyExtensionImpl(system) new PersistencePluginProxyExtensionImpl(system)
override def lookup(): ExtensionId[_ <: Extension] = PersistencePluginProxyExtension override def lookup: ExtensionId[_ <: Extension] = PersistencePluginProxyExtension
override def get(system: ActorSystem): PersistencePluginProxyExtensionImpl = super.get(system) override def get(system: ActorSystem): PersistencePluginProxyExtensionImpl = super.get(system)
override def get(system: ClassicActorSystemProvider): PersistencePluginProxyExtensionImpl = super.get(system) override def get(system: ClassicActorSystemProvider): PersistencePluginProxyExtensionImpl = super.get(system)
} }

View file

@ -61,11 +61,12 @@ trait SnapshotStore extends Actor with ActorLogging {
} }
.recover { .recover {
case e => SaveSnapshotFailure(metadata, e) case e => SaveSnapshotFailure(metadata, e)
} to (self, senderPersistentActor()) }
.to(self, senderPersistentActor())
case evt: SaveSnapshotSuccess => case evt: SaveSnapshotSuccess =>
try tryReceivePluginInternal(evt) try tryReceivePluginInternal(evt)
finally senderPersistentActor ! evt // sender is persistentActor finally senderPersistentActor() ! evt // sender is persistentActor
case evt @ SaveSnapshotFailure(metadata, _) => case evt @ SaveSnapshotFailure(metadata, _) =>
try { try {
tryReceivePluginInternal(evt) tryReceivePluginInternal(evt)

View file

@ -70,7 +70,7 @@ class SteppingInMemPersistentActorBoundedStashingSpec(strategyConfig: String)
with BeforeAndAfterEach with BeforeAndAfterEach
with ImplicitSender { with ImplicitSender {
override def atStartup: Unit = { override def atStartup(): Unit = {
system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*received dead letter from.*Cmd.*"))) system.eventStream.publish(Mute(EventFilter.warning(pattern = ".*received dead letter from.*Cmd.*")))
} }

View file

@ -78,7 +78,7 @@ akka.persistence.snapshot-store.plugin = "akka.persistence.no-snapshot-store"
} }
object JournalPuppet extends ExtensionId[JournalProbe] with ExtensionIdProvider { object JournalPuppet extends ExtensionId[JournalProbe] with ExtensionIdProvider {
override def lookup() = JournalPuppet override def lookup = JournalPuppet
override def createExtension(system: ExtendedActorSystem): JournalProbe = override def createExtension(system: ExtendedActorSystem): JournalProbe =
new JournalProbe()(system) new JournalProbe()(system)

View file

@ -6,7 +6,6 @@ package akka.persistence
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.runtime.BoxedUnit import scala.runtime.BoxedUnit
import scala.runtime.BoxedUnit
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory

View file

@ -50,7 +50,7 @@ class ArteryAttemptSysMsgRedeliveryMultiJvmNode3
object AttemptSysMsgRedeliverySpec { object AttemptSysMsgRedeliverySpec {
class Echo extends Actor { class Echo extends Actor {
def receive = { def receive = {
case m => sender ! m case m => sender() ! m
} }
} }
} }

View file

@ -11,7 +11,6 @@ import com.typesafe.config.ConfigFactory
import akka.actor._ import akka.actor._
import akka.remote.testconductor.RoleName import akka.remote.testconductor.RoleName
import akka.remote.testconductor.RoleName
import akka.remote.testkit.MultiNodeConfig import akka.remote.testkit.MultiNodeConfig
import akka.testkit._ import akka.testkit._

View file

@ -4,7 +4,6 @@
package akka.remote package akka.remote
import scala.concurrent.duration._
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration

View file

@ -9,7 +9,6 @@ import com.typesafe.config._
import akka.ConfigurationException import akka.ConfigurationException
import akka.actor._ import akka.actor._
import akka.japi.Util.immutableSeq import akka.japi.Util.immutableSeq
import akka.remote.routing._
import akka.remote.routing.RemoteRouterConfig import akka.remote.routing.RemoteRouterConfig
import akka.routing._ import akka.routing._
import akka.routing.Pool import akka.routing.Pool

View file

@ -55,7 +55,7 @@ private[akka] final case class RARP(provider: RemoteActorRefProvider) extends Ex
*/ */
private[akka] object RARP extends ExtensionId[RARP] with ExtensionIdProvider { private[akka] object RARP extends ExtensionId[RARP] with ExtensionIdProvider {
override def lookup() = RARP override def lookup = RARP
override def createExtension(system: ExtendedActorSystem) = RARP(system.provider.asInstanceOf[RemoteActorRefProvider]) override def createExtension(system: ExtendedActorSystem) = RARP(system.provider.asInstanceOf[RemoteActorRefProvider])
} }

View file

@ -27,7 +27,7 @@ object RemotingFlightRecorder extends ExtensionId[RemotingFlightRecorder] with E
"akka.remote.artery.jfr.JFRRemotingFlightRecorder", "akka.remote.artery.jfr.JFRRemotingFlightRecorder",
NoOpRemotingFlightRecorder) NoOpRemotingFlightRecorder)
override def lookup(): ExtensionId[_ <: Extension] = this override def lookup: ExtensionId[_ <: Extension] = this
} }
/** /**

View file

@ -30,7 +30,7 @@ trait BindCanonicalAddressBehaviors {
implicit val sys = ActorSystem("sys", config.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", config.withFallback(commonConfig))
getInternal should contain(getExternal()) getInternal() should contain(getExternal())
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} }
@ -44,7 +44,7 @@ trait BindCanonicalAddressBehaviors {
implicit val sys = ActorSystem("sys", config.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", config.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress("akka")) getExternal() should ===(address.toAkkaAddress("akka"))
// May have selected the same random port - bind another in that case while the other still has the canonical port // May have selected the same random port - bind another in that case while the other still has the canonical port
val internals = val internals =
if (getInternal().collect { case Address(_, _, _, Some(port)) => port }.toSeq.contains(address.getPort)) { if (getInternal().collect { case Address(_, _, _, Some(port)) => port }.toSeq.contains(address.getPort)) {
@ -82,8 +82,8 @@ trait BindCanonicalAddressBehaviors {
implicit val sys = ActorSystem("sys", config.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", config.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress("akka")) getExternal() should ===(address.toAkkaAddress("akka"))
getInternal should contain(address.toAkkaAddress("akka")) getInternal() should contain(address.toAkkaAddress("akka"))
} }
"bind to all interfaces" in { "bind to all interfaces" in {

View file

@ -6,7 +6,6 @@ package akka.remote.artery.compress
import scala.concurrent.duration._ import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
import akka.actor._ import akka.actor._

View file

@ -55,7 +55,7 @@ class NettyTransportSpec extends AnyWordSpec with Matchers with BindBehavior {
""") """)
implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig))
getInternal should contain(getExternal.withProtocol("tcp")) getInternal() should contain(getExternal().withProtocol("tcp"))
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} }
@ -74,8 +74,8 @@ class NettyTransportSpec extends AnyWordSpec with Matchers with BindBehavior {
""") """)
implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress("akka.tcp")) getExternal() should ===(address.toAkkaAddress("akka.tcp"))
getInternal should not contain address.toAkkaAddress("tcp") getInternal() should not contain address.toAkkaAddress("tcp")
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} finally { } finally {
@ -102,8 +102,8 @@ class NettyTransportSpec extends AnyWordSpec with Matchers with BindBehavior {
""") """)
implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress("akka.tcp")) getExternal() should ===(address.toAkkaAddress("akka.tcp"))
getInternal should contain(address.toAkkaAddress("tcp")) getInternal() should contain(address.toAkkaAddress("tcp"))
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} }
@ -147,8 +147,8 @@ trait BindBehavior {
""") """)
implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress(s"akka.tcp")) getExternal() should ===(address.toAkkaAddress(s"akka.tcp"))
getInternal should contain(address.toAkkaAddress("tcp")) getInternal() should contain(address.toAkkaAddress("tcp"))
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} }
@ -179,8 +179,8 @@ trait BindBehavior {
""") """)
implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig)) implicit val sys = ActorSystem("sys", bindConfig.withFallback(commonConfig))
getExternal should ===(address.toAkkaAddress(s"akka.tcp")) getExternal() should ===(address.toAkkaAddress(s"akka.tcp"))
getInternal should contain(bindAddress.toAkkaAddress("tcp")) getInternal() should contain(bindAddress.toAkkaAddress("tcp"))
Await.result(sys.terminate(), Duration.Inf) Await.result(sys.terminate(), Duration.Inf)
} }

View file

@ -4,7 +4,6 @@
package akka.stream.testkit package akka.stream.testkit
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.ThreadLocalRandom
import scala.annotation.tailrec import scala.annotation.tailrec
@ -19,7 +18,6 @@ import akka.actor.ActorSystem
import akka.stream.ActorMaterializerSettings import akka.stream.ActorMaterializerSettings
import akka.stream.Materializer import akka.stream.Materializer
import akka.stream.SystemMaterializer import akka.stream.SystemMaterializer
import akka.stream.SystemMaterializer
import akka.stream.scaladsl.Flow import akka.stream.scaladsl.Flow
import akka.stream.scaladsl.Sink import akka.stream.scaladsl.Sink
import akka.stream.scaladsl.Source import akka.stream.scaladsl.Source

View file

@ -29,7 +29,7 @@ object IndirectMaterializerCreation extends ExtensionId[IndirectMaterializerCrea
def createExtension(system: ExtendedActorSystem): IndirectMaterializerCreation = def createExtension(system: ExtendedActorSystem): IndirectMaterializerCreation =
new IndirectMaterializerCreation(system) new IndirectMaterializerCreation(system)
def lookup(): ExtensionId[IndirectMaterializerCreation] = this def lookup: ExtensionId[IndirectMaterializerCreation] = this
} }
@silent @silent

View file

@ -102,7 +102,7 @@ class FusingSpec extends StreamSpec {
} }
"propagate downstream errors through async boundary" in { "propagate downstream errors through async boundary" in {
val promise = Promise[Done] val promise = Promise[Done]()
val slowInitSrc = UnfoldResourceNoAsyncBoundry( val slowInitSrc = UnfoldResourceNoAsyncBoundry(
() => { Await.result(promise.future, 1.minute); () }, () => { Await.result(promise.future, 1.minute); () },
(_: Unit) => Some(1), (_: Unit) => Some(1),
@ -132,7 +132,7 @@ class FusingSpec extends StreamSpec {
} }
"propagate 'parallel' errors through async boundary via a common downstream" in { "propagate 'parallel' errors through async boundary via a common downstream" in {
val promise = Promise[Done] val promise = Promise[Done]()
val slowInitSrc = UnfoldResourceNoAsyncBoundry( val slowInitSrc = UnfoldResourceNoAsyncBoundry(
() => { Await.result(promise.future, 1.minute); () }, () => { Await.result(promise.future, 1.minute); () },
(_: Unit) => Some(1), (_: Unit) => Some(1),

View file

@ -39,7 +39,7 @@ class SystemMaterializerEagerStartupSpec extends StreamSpec {
"The SystemMaterializer" must { "The SystemMaterializer" must {
"be eagerly started on system startup" in { "be eagerly started on system startup" in {
system.hasExtension(SystemMaterializer.lookup()) should ===(true) system.hasExtension(SystemMaterializer.lookup) should ===(true)
} }
} }

View file

@ -101,7 +101,7 @@ class LifecycleInterpreterSpec extends StreamSpec with GraphInterpreterSpecKit {
lastEvents() should ===(Set()) lastEvents() should ===(Set())
upstream.onComplete() upstream.onComplete()
lastEvents should ===(Set(OnComplete)) lastEvents() should ===(Set(OnComplete))
} }
"postStop when pushAndFinish called if upstream completes with pushAndFinish" in new OneBoundedSetup[String]( "postStop when pushAndFinish called if upstream completes with pushAndFinish" in new OneBoundedSetup[String](

View file

@ -15,7 +15,6 @@ import scala.concurrent.Future
import scala.concurrent.Promise import scala.concurrent.Promise
import scala.concurrent.duration._ import scala.concurrent.duration._
import com.github.ghik.silencer.silent
import com.github.ghik.silencer.silent import com.github.ghik.silencer.silent
import com.typesafe.config.Config import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory

View file

@ -47,7 +47,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 2) prefixF.futureValue should ===(0 until 2)
suffixF.futureValue should ===(2 until 10) suffixF.futureValue should ===(2 until 10)
@ -60,7 +60,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 10) prefixF.futureValue should ===(0 until 10)
suffixF.futureValue should be(empty) suffixF.futureValue should be(empty)
@ -73,7 +73,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 10) prefixF.futureValue should ===(0 until 10)
suffixF.futureValue should be(empty) suffixF.futureValue should be(empty)
@ -87,7 +87,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
.take(10) .take(10)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 10) prefixF.futureValue should ===(0 until 10)
suffixF.futureValue should ===(10 until 20) suffixF.futureValue should ===(10 until 20)
@ -100,7 +100,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.to(Sink.ignore) .to(Sink.ignore)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
val ex = suffixF.failed.futureValue val ex = suffixF.failed.futureValue
ex.getCause should not be null ex.getCause should not be null
@ -117,7 +117,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.ignore)(Keep.both) .toMat(Sink.ignore)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 10) prefixF.futureValue should ===(0 until 10)
val ex = suffixF.failed.futureValue val ex = suffixF.failed.futureValue
ex should ===(TE("don't like 15 either!")) ex should ===(TE("don't like 15 either!"))
@ -203,7 +203,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 4) prefixF.futureValue should ===(0 until 4)
suffixF.futureValue should be(empty) suffixF.futureValue should be(empty)
@ -221,7 +221,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 4) prefixF.futureValue should ===(0 until 4)
suffixF.futureValue should be(empty) suffixF.futureValue should be(empty)
@ -234,7 +234,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.futureValue should ===(0 until 4) prefixF.futureValue should ===(0 until 4)
suffixF.futureValue should ===(11 :: 12 :: Nil) suffixF.futureValue should ===(11 :: 12 :: Nil)
@ -247,7 +247,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
prefixF.failed.futureValue should be(a[NeverMaterializedException]) prefixF.failed.futureValue should be(a[NeverMaterializedException])
prefixF.failed.futureValue.getCause should ===(TE("boom-bada-bang (4)")) prefixF.failed.futureValue.getCause should ===(TE("boom-bada-bang (4)"))
@ -265,7 +265,7 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
}(Keep.right) }(Keep.right)
.toMat(Sink.seq)(Keep.both) .toMat(Sink.seq)(Keep.both)
.withAttributes(attributes) .withAttributes(attributes)
.run .run()
suffixF.futureValue should be(empty) suffixF.futureValue should be(empty)
val (prefix, suffix) = prefixAndTailF.futureValue val (prefix, suffix) = prefixAndTailF.futureValue

View file

@ -48,7 +48,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"work in the simple case with a late future" in assertAllStagesStopped { "work in the simple case with a late future" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10() val (fNotUsed, fSeq) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -85,7 +85,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"fail properly when future is late completed failed future" in assertAllStagesStopped { "fail properly when future is late completed failed future" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10() val (fNotUsed, fSeq) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -126,7 +126,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"handle upstream failure when future is late-completed" in assertAllStagesStopped { "handle upstream failure when future is late-completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10WithFailure()(5) val (fNotUsed, fSeq) = src10WithFailure()(5)
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -166,7 +166,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"propagate upstream failure when future is late-completed" in assertAllStagesStopped { "propagate upstream failure when future is late-completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10WithFailure()(5) val (fNotUsed, fSeq) = src10WithFailure()(5)
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -210,7 +210,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"handle early upstream error when flow future is late-completed" in assertAllStagesStopped { "handle early upstream error when flow future is late-completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = Source val (fNotUsed, fSeq) = Source
.failed(TE("not today my friend")) .failed(TE("not today my friend"))
.viaMat { .viaMat {
@ -257,7 +257,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"handle closed downstream when flow future is late completed" in assertAllStagesStopped { "handle closed downstream when flow future is late completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]] val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]]()
val (fSeq1, fSeq2) = src10() val (fSeq1, fSeq2) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -305,7 +305,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"handle early downstream failure when flow future is late completed" in assertAllStagesStopped { "handle early downstream failure when flow future is late completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]] val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]]()
val (fSeq1, fSeq2) = src10() val (fSeq1, fSeq2) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -351,7 +351,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"handle early upstream completion when flow future is late-completed" in assertAllStagesStopped { "handle early upstream completion when flow future is late-completed" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = Source val (fNotUsed, fSeq) = Source
.empty[Int] .empty[Int]
.viaMat { .viaMat {
@ -389,7 +389,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"fails properly on materialization failure with a late future" in assertAllStagesStopped { "fails properly on materialization failure with a late future" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10() val (fNotUsed, fSeq) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -429,7 +429,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"propagate flow failures with a late future" in assertAllStagesStopped { "propagate flow failures with a late future" in assertAllStagesStopped {
val prFlow = Promise[Flow[Int, Int, NotUsed]] val prFlow = Promise[Flow[Int, Int, NotUsed]]()
val (fNotUsed, fSeq) = src10() val (fNotUsed, fSeq) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)
@ -471,7 +471,7 @@ class FlowFutureFlowSpec extends StreamSpec {
} }
"allow flow to handle downstream completion with a late future" in assertAllStagesStopped { "allow flow to handle downstream completion with a late future" in assertAllStagesStopped {
val pr = Promise[Flow[Int, Int, Future[Seq[Int]]]] val pr = Promise[Flow[Int, Int, Future[Seq[Int]]]]()
val (fSeq1, fSeq2) = src10() val (fSeq1, fSeq2) = src10()
.viaMat { .viaMat {
Flow.futureFlow(pr.future) Flow.futureFlow(pr.future)
@ -494,7 +494,7 @@ class FlowFutureFlowSpec extends StreamSpec {
"abrupt termination before future completion" in assertAllStagesStopped { "abrupt termination before future completion" in assertAllStagesStopped {
val mat = Materializer(system) val mat = Materializer(system)
val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]] val prFlow = Promise[Flow[Int, Int, Future[collection.immutable.Seq[Int]]]]()
val (fSeq1, fSeq2) = src10() val (fSeq1, fSeq2) = src10()
.viaMat { .viaMat {
Flow.futureFlow(prFlow.future) Flow.futureFlow(prFlow.future)

View file

@ -252,7 +252,7 @@ class FlowMapAsyncUnorderedSpec extends StreamSpec {
} }
val result = Source(List(1, 2, 3)).via(flow).runWith(Sink.seq) val result = Source(List(1, 2, 3)).via(flow).runWith(Sink.seq)
result.futureValue should contain only ("1", "3") result.futureValue should contain.only("1", "3")
} }
"continue emitting after a sequence of nulls" in { "continue emitting after a sequence of nulls" in {
@ -263,7 +263,7 @@ class FlowMapAsyncUnorderedSpec extends StreamSpec {
val result = Source(0 to 102).via(flow).runWith(Sink.seq) val result = Source(0 to 102).via(flow).runWith(Sink.seq)
result.futureValue should contain only ("0", "100", "101", "102") result.futureValue should contain.only("0", "100", "101", "102")
} }
"complete without emitting any element after a sequence of nulls only" in { "complete without emitting any element after a sequence of nulls only" in {
@ -293,7 +293,7 @@ class FlowMapAsyncUnorderedSpec extends StreamSpec {
val result = Source(List(1, 2, 3)).via(flow).runWith(Sink.seq) val result = Source(List(1, 2, 3)).via(flow).runWith(Sink.seq)
result.futureValue should contain only ("1", "3") result.futureValue should contain.only("1", "3")
} }
"handle cancel properly" in assertAllStagesStopped { "handle cancel properly" in assertAllStagesStopped {

View file

@ -127,7 +127,7 @@ class QueueSourceSpec extends StreamSpec {
val queue = Source.queue(0, OverflowStrategy.dropHead).to(Sink.fromSubscriber(s)).run() val queue = Source.queue(0, OverflowStrategy.dropHead).to(Sink.fromSubscriber(s)).run()
val sub = s.expectSubscription() val sub = s.expectSubscription()
queue.watchCompletion.pipeTo(testActor) queue.watchCompletion().pipeTo(testActor)
queue.offer(1).pipeTo(testActor) queue.offer(1).pipeTo(testActor)
expectNoMessage(pause) expectNoMessage(pause)
@ -138,7 +138,7 @@ class QueueSourceSpec extends StreamSpec {
"fail future immediately when stream is already cancelled" in assertAllStagesStopped { "fail future immediately when stream is already cancelled" in assertAllStagesStopped {
val queue = Source.queue[Int](0, OverflowStrategy.dropHead).to(Sink.cancelled).run() val queue = Source.queue[Int](0, OverflowStrategy.dropHead).to(Sink.cancelled).run()
queue.watchCompletion.futureValue queue.watchCompletion().futureValue
queue.offer(1).failed.futureValue shouldBe a[StreamDetachedException] queue.offer(1).failed.futureValue shouldBe a[StreamDetachedException]
} }
@ -282,7 +282,7 @@ class QueueSourceSpec extends StreamSpec {
sourceQueue1.offer("hello") sourceQueue1.offer("hello")
mat1subscriber.expectNext("hello") mat1subscriber.expectNext("hello")
mat1subscriber.cancel() mat1subscriber.cancel()
sourceQueue1.watchCompletion.pipeTo(testActor) sourceQueue1.watchCompletion().pipeTo(testActor)
expectMsg(Done) expectMsg(Done)
sourceQueue2.watchCompletion().isCompleted should ===(false) sourceQueue2.watchCompletion().isCompleted should ===(false)

View file

@ -587,7 +587,7 @@ class RestartSpec extends StreamSpec(Map("akka.test.single-expect-default" -> "1
source.sendNext("cancel") source.sendNext("cancel")
// This will complete the flow in probe and cancel the flow out probe // This will complete the flow in probe and cancel the flow out probe
flowInProbe.request(2) flowInProbe.request(2)
Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain only ("in complete", "out complete") Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain.only("in complete", "out complete")
// and it should restart // and it should restart
source.sendNext("c") source.sendNext("c")
@ -611,7 +611,7 @@ class RestartSpec extends StreamSpec(Map("akka.test.single-expect-default" -> "1
// This will complete the flow in probe and cancel the flow out probe // This will complete the flow in probe and cancel the flow out probe
flowInProbe.request(2) flowInProbe.request(2)
Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain only ("in complete", "out complete") Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain.only("in complete", "out complete")
// and it should restart // and it should restart
source.sendNext("c") source.sendNext("c")
@ -661,7 +661,7 @@ class RestartSpec extends StreamSpec(Map("akka.test.single-expect-default" -> "1
source.sendNext("cancel") source.sendNext("cancel")
// This will complete the flow in probe and cancel the flow out probe // This will complete the flow in probe and cancel the flow out probe
flowInProbe.request(2) flowInProbe.request(2)
Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain only ("in complete", "out complete") Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain.only("in complete", "out complete")
source.sendNext("c") source.sendNext("c")
flowInProbe.request(1) flowInProbe.request(1)
@ -726,7 +726,7 @@ class RestartSpec extends StreamSpec(Map("akka.test.single-expect-default" -> "1
// This will complete the flow in probe and cancel the flow out probe // This will complete the flow in probe and cancel the flow out probe
flowInProbe.request(2) flowInProbe.request(2)
Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain only ("in complete", "out complete") Seq(flowInProbe.expectNext(), flowInProbe.expectNext()) should contain.only("in complete", "out complete")
// and it should restart // and it should restart
sink.request(1) sink.request(1)

View file

@ -103,7 +103,7 @@ class SinkForeachAsyncSpec extends StreamSpec {
} }
val p = val p =
Source(List(one _, two _, three _, four _)).runWith(sink) Source(List(() => one, () => two, () => three, () => four)).runWith(sink)
latch(1).countDown() latch(1).countDown()
probe.expectMsg(1) probe.expectMsg(1)

View file

@ -80,7 +80,7 @@ class UnfoldResourceAsyncSourceSpec extends StreamSpec(UnboundedMailboxConfig) {
val probe = TestSubscriber.probe[Int]() val probe = TestSubscriber.probe[Int]()
Source Source
.unfoldResourceAsync[Int, ResourceDummy[Int]](resource.create _, _.read, _.close()) .unfoldResourceAsync[Int, ResourceDummy[Int]](() => resource.create, _.read, _.close())
.runWith(Sink.fromSubscriber(probe)) .runWith(Sink.fromSubscriber(probe))
probe.request(1) probe.request(1)
@ -106,7 +106,7 @@ class UnfoldResourceAsyncSourceSpec extends StreamSpec(UnboundedMailboxConfig) {
val resource = new ResourceDummy[Int](1 :: Nil, firstReadFuture = firstRead.future) val resource = new ResourceDummy[Int](1 :: Nil, firstReadFuture = firstRead.future)
Source Source
.unfoldResourceAsync[Int, ResourceDummy[Int]](resource.create _, _.read, _.close()) .unfoldResourceAsync[Int, ResourceDummy[Int]](() => resource.create, _.read, _.close())
.runWith(Sink.fromSubscriber(probe)) .runWith(Sink.fromSubscriber(probe))
probe.request(1L) probe.request(1L)

View file

@ -12,8 +12,6 @@ import scala.annotation.tailrec
import scala.compat.java8.OptionConverters._ import scala.compat.java8.OptionConverters._
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
import scala.reflect.{ classTag, ClassTag } import scala.reflect.{ classTag, ClassTag }
import akka.japi.function
import java.time.Duration
import akka.annotation.ApiMayChange import akka.annotation.ApiMayChange
import akka.annotation.DoNotInherit import akka.annotation.DoNotInherit
@ -21,13 +19,8 @@ import akka.annotation.InternalApi
import akka.event.Logging import akka.event.Logging
import akka.japi.function import akka.japi.function
import akka.stream.impl.TraversalBuilder import akka.stream.impl.TraversalBuilder
import akka.util.JavaDurationConverters._
import akka.util.JavaDurationConverters._
import scala.compat.java8.OptionConverters._
import akka.util.{ ByteString, OptionVal } import akka.util.{ ByteString, OptionVal }
import akka.util.JavaDurationConverters._
import scala.concurrent.duration.FiniteDuration
/** /**
* Holds attributes which can be used to alter [[akka.stream.scaladsl.Flow]] / [[akka.stream.javadsl.Flow]] * Holds attributes which can be used to alter [[akka.stream.scaladsl.Flow]] / [[akka.stream.javadsl.Flow]]

View file

@ -176,7 +176,7 @@ private[akka] class SubFusingActorMaterializerImpl(
@InternalApi private[akka] object FlowNames extends ExtensionId[FlowNames] with ExtensionIdProvider { @InternalApi private[akka] object FlowNames extends ExtensionId[FlowNames] with ExtensionIdProvider {
override def get(system: ActorSystem): FlowNames = super.get(system) override def get(system: ActorSystem): FlowNames = super.get(system)
override def get(system: ClassicActorSystemProvider): FlowNames = super.get(system) override def get(system: ClassicActorSystemProvider): FlowNames = super.get(system)
override def lookup() = FlowNames override def lookup = FlowNames
override def createExtension(system: ExtendedActorSystem): FlowNames = new FlowNames override def createExtension(system: ExtendedActorSystem): FlowNames = new FlowNames
} }

View file

@ -250,7 +250,7 @@ import akka.util.unused
} }
registerCompleted(id) registerCompleted(id)
inputs(id).subreceive(ActorSubscriberMessage.OnComplete) inputs(id).subreceive(ActorSubscriberMessage.OnComplete)
if (!receivedInput && isAllCompleted) onCompleteWhenNoInput() if (!receivedInput && isAllCompleted()) onCompleteWhenNoInput()
case OnError(id, e) => case OnError(id, e) =>
onError(id, e) onError(id, e)
}) })

View file

@ -9,7 +9,6 @@ import java.util.concurrent.atomic.AtomicBoolean
import scala.collection.immutable.Map import scala.collection.immutable.Map
import scala.concurrent.ExecutionContextExecutor import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
import com.github.ghik.silencer.silent import com.github.ghik.silencer.silent
@ -45,7 +44,6 @@ import akka.stream.stage.GraphStageLogic
import akka.stream.stage.InHandler import akka.stream.stage.InHandler
import akka.stream.stage.OutHandler import akka.stream.stage.OutHandler
import akka.util.OptionVal import akka.util.OptionVal
import akka.util.OptionVal
/** /**
* INTERNAL API * INTERNAL API

View file

@ -6,7 +6,6 @@ package akka.stream.impl
import scala.annotation.tailrec import scala.annotation.tailrec
import SubscriberManagement.ShutDown
import org.reactivestreams.{ Subscriber, Subscription } import org.reactivestreams.{ Subscriber, Subscription }
/** /**

Some files were not shown because too many files have changed in this diff Show more