actor: allow seamless access to untyped extensions given typed ActorSystem (#28294)
* actor: allow seamless access to untyped extensions given typed ActorSystem * add overrides with concrete type for Java API everywhere
This commit is contained in:
parent
2c96a57d89
commit
702b6a7f41
70 changed files with 192 additions and 49 deletions
|
|
@ -203,7 +203,6 @@ abstract class ClusterSingleton extends Extension {
|
|||
}
|
||||
|
||||
object ClusterSingletonManagerSettings {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
|
||||
/**
|
||||
* Create settings from the default configuration
|
||||
|
|
@ -211,7 +210,7 @@ object ClusterSingletonManagerSettings {
|
|||
*/
|
||||
def apply(system: ActorSystem[_]): ClusterSingletonManagerSettings =
|
||||
apply(system.settings.config.getConfig("akka.cluster.singleton"))
|
||||
.withRemovalMargin(akka.cluster.Cluster(system.toClassic).downingProvider.downRemovalMargin)
|
||||
.withRemovalMargin(akka.cluster.Cluster(system).downingProvider.downRemovalMargin)
|
||||
|
||||
/**
|
||||
* Create settings from a configuration with the same layout as
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ private[akka] final class AdapterClusterImpl(system: ActorSystem[_]) extends Clu
|
|||
import AdapterClusterImpl._
|
||||
|
||||
require(system.isInstanceOf[ActorSystemAdapter[_]], "only adapted actor systems can be used for cluster features")
|
||||
private val classicCluster = akka.cluster.Cluster(system.toClassic)
|
||||
private val classicCluster = akka.cluster.Cluster(system)
|
||||
|
||||
override def selfMember: Member = classicCluster.selfMember
|
||||
override def isTerminated: Boolean = classicCluster.isTerminated
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ActorSystemSpec
|
|||
akka.remote.classic.netty.tcp.port = 0
|
||||
akka.remote.artery.canonical.port = 0
|
||||
akka.remote.artery.canonical.hostname = 127.0.0.1
|
||||
|
||||
|
||||
serializers {
|
||||
test = "akka.cluster.typed.ActorSystemSpec$$TestSerializer"
|
||||
}
|
||||
|
|
@ -114,8 +114,7 @@ class ActorSystemSpec
|
|||
}
|
||||
inbox.receiveAll() should ===("hello" :: Nil)
|
||||
sys.whenTerminated.futureValue
|
||||
CoordinatedShutdown(sys.toClassic).shutdownReason() should ===(
|
||||
Some(CoordinatedShutdown.ActorSystemTerminateReason))
|
||||
CoordinatedShutdown(sys).shutdownReason() should ===(Some(CoordinatedShutdown.ActorSystemTerminateReason))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +149,7 @@ class ActorSystemSpec
|
|||
// now we know that the guardian has started, and should receive PostStop
|
||||
sys.terminate()
|
||||
sys.whenTerminated.futureValue
|
||||
CoordinatedShutdown(sys.toClassic).shutdownReason() should ===(
|
||||
Some(CoordinatedShutdown.ActorSystemTerminateReason))
|
||||
CoordinatedShutdown(sys).shutdownReason() should ===(Some(CoordinatedShutdown.ActorSystemTerminateReason))
|
||||
inbox.receiveAll() should ===("done" :: Nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import akka.actor.typed.ActorRef
|
|||
import akka.actor.typed.receptionist.Receptionist
|
||||
import akka.actor.typed.receptionist.ServiceKey
|
||||
import akka.actor.typed.scaladsl.Behaviors
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
import akka.cluster.MemberStatus
|
||||
import akka.cluster.typed.Cluster
|
||||
import akka.cluster.typed.Down
|
||||
|
|
@ -210,7 +209,7 @@ class ClusterReceptionistSpec extends WordSpec with Matchers with LogCapturing {
|
|||
|
||||
regProbe2.expectMessageType[Listing].serviceInstances(PingKey).size should ===(2)
|
||||
|
||||
akka.cluster.Cluster(system1.toClassic).shutdown()
|
||||
akka.cluster.Cluster(system1).shutdown()
|
||||
|
||||
regProbe2.expectNoMessage(3.seconds)
|
||||
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ object Publisher {
|
|||
Behaviors.setup[AnyRef] { context =>
|
||||
import akka.cluster.pubsub.DistributedPubSub
|
||||
import akka.cluster.pubsub.DistributedPubSubMediator
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
val mediator = DistributedPubSub(context.system.toClassic).mediator
|
||||
val mediator = DistributedPubSub(context.system).mediator
|
||||
|
||||
var registry: Map[DataKey, DataType] = Map.empty
|
||||
|
||||
|
|
@ -263,8 +262,7 @@ object DataPlatform {
|
|||
def apply(): Behavior[ProvisionCommand] = {
|
||||
Behaviors.setup { context =>
|
||||
//#mediator
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
val mediator = DistributedPubSub(context.system.toClassic).mediator
|
||||
val mediator = DistributedPubSub(context.system).mediator
|
||||
//#mediator
|
||||
val service = context.spawn(DataService(mediator), "data")
|
||||
|
||||
|
|
@ -337,7 +335,7 @@ object DistributedPubSubExample {
|
|||
|
||||
// provision new data type
|
||||
val platformProbe = TestProbe[DataApi]()(system)
|
||||
val mediator = DistributedPubSub(system.toClassic).mediator
|
||||
val mediator = DistributedPubSub(system).mediator
|
||||
mediator ! DistributedPubSubMediator.Subscribe(IngestionTopic, platformProbe.ref.toClassic)
|
||||
|
||||
system ! ProvisionDataType(key, "dummy-schema", platformProbe.ref)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue