Skip to content

Commit

Permalink
Akka.Coordination: minor cleanup (#5074)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored Jun 4, 2021
1 parent 95cdfac commit 16fef39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/core/Akka.Cluster/SBR/SplitBrainResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ private void OnAcquireLease()
{
Log.Debug("SBR trying to acquire lease");
//implicit val ec: ExecutionContext = internalDispatcher

Strategy.Lease?.Acquire().ContinueWith(r =>
{
if (r.IsFaulted)
Expand All @@ -385,7 +386,7 @@ private void OnAcquireLease()

public Receive WaitingForLease(IDecision decision)
{
bool Receive(object message)
bool ReceiveLease(object message)
{
switch (message)
{
Expand Down Expand Up @@ -426,7 +427,7 @@ bool Receive(object message)
}

Stash.UnstashAll();
Context.Become(Receive);
Context.Become(ReceiveLease);
return true;

case ReleaseLeaseResult lr:
Expand All @@ -441,7 +442,7 @@ bool Receive(object message)
}
}

return Receive;
return ReceiveLease;
}

private void OnReleaseLeaseResult(bool released)
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka.Coordination/LeaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static LeaseProvider Get(ActorSystem system)
}

private readonly ExtendedActorSystem _system;
private readonly ConcurrentDictionary<LeaseKey, Lease> leases = new ConcurrentDictionary<LeaseKey, Lease>();
private readonly ConcurrentDictionary<LeaseKey, Lease> _leases = new ConcurrentDictionary<LeaseKey, Lease>();

private ILoggingAdapter _log;

Expand Down Expand Up @@ -122,7 +122,7 @@ public Lease GetLease(string leaseName, string configPath, string ownerName)
{
var leaseKey = new LeaseKey(leaseName, configPath, ownerName);

return leases.GetOrAdd(leaseKey, lk =>
return _leases.GetOrAdd(leaseKey, lk =>
{
var leaseConfig = _system.Settings.Config
.GetConfig(configPath)
Expand Down Expand Up @@ -151,7 +151,7 @@ public Lease GetLease(string leaseName, string configPath, string ownerName)
Log.Error(
ex,
"Invalid lease configuration for leaseName [{0}], configPath [{1}] lease-class [{2}]. " +
"The class must implement scaladsl.Lease or javadsl.Lease and have constructor with LeaseSettings parameter and " +
"The class must implement Akka.Coordination.Lease and have constructor with LeaseSettings parameter and " +
"optionally ActorSystem parameter.",
settings.LeaseName,
configPath,
Expand Down

0 comments on commit 16fef39

Please sign in to comment.