Skip to content

Commit

Permalink
reduced breaking API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Horusiath committed Sep 7, 2017
1 parent 27c63c6 commit f6eea05
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ private Props PropsFromProto(Proto.Msg.PropsData protoProps)
);
}

return Props.Create(actorClass, args).WithDeploy(DeployFromProto(protoProps.Deploy));
// we don't want to break proto contract, thankfully DynamicProps
// are using fallback to Activator instantiation anyway
return new Props(DeployFromProto(protoProps.Deploy), actorClass, args);
}

//
Expand Down
1 change: 1 addition & 0 deletions src/core/Akka.Tests/Actor/LocalActorRefProviderSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void A_LocalActorRefs_ActorCell_must_not_retain_its_original_Props_when_T
{
var childPropsAfterTermination = ((LocalActorRef)child).Underlying.Props;
Assert.NotEqual(childPropsBeforeTermination, childPropsAfterTermination);
Assert.IsType<TerminatedProps>(childPropsAfterTermination);
});
}

Expand Down
11 changes: 10 additions & 1 deletion src/core/Akka/Actor/ActorCell.FaultHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ private void FaultRecreate(Exception cause)
// if the actor fails in preRestart, we can do nothing but log it: it’s best-effort

failedActor.AroundPreRestart(cause, optionalMessage);
if (failedActor is IActorStash stashed)
{
stashed.Stash.UnstashAll();
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -279,6 +283,11 @@ private void FinishTerminate()
try
{
a?.AroundPostStop();

if (a is IActorStash stashed)
{
stashed.Stash.UnstashAll();
}
}
catch (Exception x)
{
Expand All @@ -303,7 +312,7 @@ private void FinishTerminate()
Publish(new Debug(_self.Path.ToString(), ActorType, "Stopped"));

ClearActor(a);
Dispose();
ClearActorCell();

_actor = null;

Expand Down
9 changes: 5 additions & 4 deletions src/core/Akka/Actor/ActorCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Akka.Actor
/// <summary>
/// TBD
/// </summary>
public partial class ActorCell : IUntypedActorContext, ICell, IDisposable
public partial class ActorCell : IUntypedActorContext, ICell
{
/// <summary>NOTE! Only constructor and ClearActorFields is allowed to update this</summary>
private IInternalActorRef _self;
Expand Down Expand Up @@ -354,9 +354,9 @@ protected virtual ActorBase CreateNewActorInstance()
{
var actor = _scope.Create();

if (actor is IWithUnboundedStash stashed)
if (actor is IActorStash stashed)
{
stashed.Stash = this.CreateStash(_props.Type);
stashed.Stash = this.CreateStash(stashed);
}

if (actor is IInitializableActor initializable)
Expand Down Expand Up @@ -426,10 +426,11 @@ public virtual void SendMessage(IActorRef sender, object message)
/// <summary>
/// TBD
/// </summary>
public void Dispose()
protected void ClearActorCell()
{
UnstashAll();
_scope.Dispose();
_props = TerminatedProps.Instance;
}

/// <summary>
Expand Down
Loading

0 comments on commit f6eea05

Please sign in to comment.