-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port scala akka PR #26816 to Akka.NET #4511
Changes from 15 commits
91adfb9
9a7a041
ff7d06a
d9a0e9c
1d6e588
9acb12a
e76172b
14ce58b
9d7ebb1
7af7a15
5fe55d4
cc99809
32a0736
8f8f6f0
c7237bf
f6745fa
00884de
eea49ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,7 +262,7 @@ public ClusterSharding(ExtendedActorSystem system) | |
{ | ||
var guardianName = system.Settings.Config.GetString("akka.cluster.sharding.guardian-name"); | ||
var dispatcher = system.Settings.Config.GetString("akka.cluster.sharding.use-dispatcher"); | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.DefaultDispatcherId; | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM - looks like all of the sharding /system actors (the guardians and coordinators) are supposed to run on the internal dispatcher |
||
return system.SystemActorOf(Props.Create(() => new ClusterShardingGuardian()).WithDispatcher(dispatcher), guardianName); | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ private IActorRef CreateReceptionist() | |
{ | ||
var name = _config.GetString("name"); | ||
var dispatcher = _config.GetString("use-dispatcher", null); | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.DefaultDispatcherId; | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM |
||
|
||
// important to use var mediator here to activate it outside of ClusterReceptionist constructor | ||
var mediator = PubSubMediator; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
using Akka.Actor; | ||
using Akka.Configuration; | ||
using Akka.Coordination; | ||
using Akka.Dispatch; | ||
using Akka.Event; | ||
using Akka.Pattern; | ||
using Akka.Remote; | ||
|
@@ -604,7 +605,9 @@ public static Props Props(Props singletonProps, ClusterSingletonManagerSettings | |
/// <returns>TBD</returns> | ||
public static Props Props(Props singletonProps, object terminationMessage, ClusterSingletonManagerSettings settings) | ||
{ | ||
return Actor.Props.Create(() => new ClusterSingletonManager(singletonProps, terminationMessage, settings)).WithDeploy(Deploy.Local); | ||
return Actor.Props.Create(() => new ClusterSingletonManager(singletonProps, terminationMessage, settings)) | ||
.WithDispatcher(Dispatchers.InternalDispatcherId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM |
||
.WithDeploy(Deploy.Local); | ||
} | ||
|
||
private readonly Props _singletonProps; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
using System.Linq; | ||
using Akka.Actor; | ||
using Akka.Configuration; | ||
using Akka.Dispatch; | ||
using Akka.Event; | ||
|
||
namespace Akka.Cluster.Tools.Singleton | ||
|
@@ -70,7 +71,9 @@ public static Config DefaultConfig() | |
/// <returns>TBD</returns> | ||
public static Props Props(string singletonManagerPath, ClusterSingletonProxySettings settings) | ||
{ | ||
return Actor.Props.Create(() => new ClusterSingletonProxy(singletonManagerPath, settings)).WithDeploy(Deploy.Local); | ||
return Actor.Props.Create(() => new ClusterSingletonProxy(singletonManagerPath, settings)) | ||
.WithDispatcher(Dispatchers.InternalDispatcherId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM |
||
.WithDeploy(Deploy.Local); | ||
} | ||
|
||
private readonly ClusterSingletonProxySettings _settings; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ public static ReplicatorSettings Create(Config config) | |
throw ConfigurationException.NullOrEmptyConfig<ReplicatorSettings>(); | ||
|
||
var dispatcher = config.GetString("use-dispatcher", null); | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.DefaultDispatcherId; | ||
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId; | ||
|
||
var durableConfig = config.GetConfig("durable"); | ||
var durableKeys = durableConfig.GetStringList("keys"); | ||
|
@@ -63,7 +63,7 @@ public static ReplicatorSettings Create(Config config) | |
{ | ||
throw new ArgumentException($"`akka.cluster.distributed-data.durable.store-actor-class` is set to an invalid class {durableStoreType}."); | ||
} | ||
durableStoreProps = Props.Create(durableStoreType, durableConfig).WithDispatcher(durableConfig.GetString("use-dispatcher")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good change |
||
durableStoreProps = Props.Create(durableStoreType, durableConfig).WithDispatcher(dispatcher); | ||
} | ||
|
||
// TODO: This constructor call fails when these fields are not populated inside the Config object: | ||
|
@@ -212,7 +212,7 @@ private ReplicatorSettings Copy(string role = null, | |
public ReplicatorSettings WithGossipInterval(TimeSpan gossipInterval) => Copy(gossipInterval: gossipInterval); | ||
public ReplicatorSettings WithNotifySubscribersInterval(TimeSpan notifySubscribersInterval) => Copy(notifySubscribersInterval: notifySubscribersInterval); | ||
public ReplicatorSettings WithMaxDeltaElements(int maxDeltaElements) => Copy(maxDeltaElements: maxDeltaElements); | ||
public ReplicatorSettings WithDispatcher(string dispatcher) => Copy(dispatcher: string.IsNullOrEmpty(dispatcher) ? Dispatchers.DefaultDispatcherId : dispatcher); | ||
public ReplicatorSettings WithDispatcher(string dispatcher) => Copy(dispatcher: string.IsNullOrEmpty(dispatcher) ? Dispatchers.InternalDispatcherId : dispatcher); | ||
public ReplicatorSettings WithPruning(TimeSpan pruningInterval, TimeSpan maxPruningDissemination) => | ||
Copy(pruningInterval: pruningInterval, maxPruningDissemination: maxPruningDissemination); | ||
public ReplicatorSettings WithDurableKeys(IImmutableSet<string> durableKeys) => Copy(durableKeys: durableKeys); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Benchmarks")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Cluster")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Cluster.Sharding")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Cluster.TestKit")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Cluster.Tests")] | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Cluster.Tests.MultiNode")] | ||
|
@@ -1841,12 +1842,13 @@ namespace Akka.Actor.Internal | |
public class ActorSystemImpl : Akka.Actor.ExtendedActorSystem | ||
{ | ||
public ActorSystemImpl(string name) { } | ||
public ActorSystemImpl(string name, Akka.Configuration.Config config, Akka.Actor.Setup.ActorSystemSetup setup) { } | ||
public ActorSystemImpl(string name, Akka.Configuration.Config config, Akka.Actor.Setup.ActorSystemSetup setup, System.Nullable<Akka.Util.Option<Akka.Actor.Props>> guardianProps = null) { } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a breaking change - need to add a separate overload. Can't add an optional parameter to an existing one. Otherwise this will break binary compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That being said, even though this API is "public" it's really only called by the |
||
public override Akka.Actor.ActorProducerPipelineResolver ActorPipelineResolver { get; } | ||
public override Akka.Actor.IActorRef DeadLetters { get; } | ||
public override Akka.Dispatch.Dispatchers Dispatchers { get; } | ||
public override Akka.Event.EventStream EventStream { get; } | ||
public override Akka.Actor.IInternalActorRef Guardian { get; } | ||
public Akka.Util.Option<Akka.Actor.Props> GuardianProps { get; } | ||
public override Akka.Event.ILoggingAdapter Log { get; } | ||
public override Akka.Actor.IInternalActorRef LookupRoot { get; } | ||
public override Akka.Dispatch.Mailboxes Mailboxes { get; } | ||
|
@@ -2452,9 +2454,10 @@ namespace Akka.Dispatch | |
} | ||
public sealed class Dispatchers | ||
{ | ||
public static readonly string DefaultBlockingDispatcherId; | ||
public static readonly string DefaultDispatcherId; | ||
public static readonly string SynchronizedDispatcherId; | ||
public Dispatchers(Akka.Actor.ActorSystem system, Akka.Dispatch.IDispatcherPrerequisites prerequisites) { } | ||
public Dispatchers(Akka.Actor.ActorSystem system, Akka.Dispatch.IDispatcherPrerequisites prerequisites, Akka.Event.ILoggingAdapter logger) { } | ||
public Akka.Configuration.Config DefaultDispatcherConfig { get; } | ||
public Akka.Dispatch.MessageDispatcher DefaultGlobalDispatcher { get; } | ||
public Akka.Dispatch.IDispatcherPrerequisites Prerequisites { get; } | ||
|
@@ -4823,6 +4826,7 @@ namespace Akka.Util | |
public static readonly Akka.Util.Option<T> None; | ||
public Option(T value) { } | ||
public bool HasValue { get; } | ||
public bool IsEmpty { get; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this if we already have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its a convenience property, it saves from typing an awkward |
||
public T Value { get; } | ||
public bool Equals(Akka.Util.Option<T> other) { } | ||
public override bool Equals(object obj) { } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,7 +293,7 @@ public void A_UnfoldResourceAsyncSource_must_use_dedicated_blocking_io_dispatche | |
var actorRef = refs.First(@ref => @ref.Path.ToString().Contains("unfoldResourceSourceAsync")); | ||
try | ||
{ | ||
Utils.AssertDispatcher(actorRef, "akka.stream.default-blocking-io-dispatcher"); | ||
Utils.AssertDispatcher(actorRef, ActorAttributes.IODispatcher.Name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM |
||
} | ||
finally | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM