Skip to content

Commit

Permalink
Merge pull request #695 from Horusiath/sys-msg-to-string
Browse files Browse the repository at this point in the history
Added meaningful ToString() to all system messages
  • Loading branch information
HCanber committed Mar 1, 2015
2 parents eae216f + 7e00996 commit 85d217f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/core/Akka/Actor/ActorSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ public ActorSelectionMessage(object message, SelectionPathElement[] elements, bo
public SelectionPathElement[] Elements { get; private set; }

public bool WildCardFanOut { get; private set; }

public override string ToString()
{
return string.Format("ActorSelectionMessage - Message: {0} - WildCartFanOut: {1} - Elements: {2}",
Message, WildCardFanOut, string.Join<SelectionPathElement>("/", Elements));
}
}

/// <summary>
Expand Down
31 changes: 28 additions & 3 deletions src/core/Akka/Actor/AutoReceivedMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface AutoReceivedMessage : NoSerializationVerificationNeeded
{
}

public sealed class
public sealed class
Terminated : AutoReceivedMessage, PossiblyHarmful
{
public Terminated(ActorRef actorRef, bool existenceConfirmed, bool addressTerminated)
Expand All @@ -26,7 +26,7 @@ public Terminated(ActorRef actorRef, bool existenceConfirmed, bool addressTermin

public override string ToString()
{
return string.Format("Terminated - ActorRef: {0} - ExistenceConfirmed: {1}", ActorRef,ExistenceConfirmed);
return "<Terminated>: " + ActorRef + " - ExistenceConfirmed=" + ExistenceConfirmed;
}
}

Expand All @@ -39,6 +39,11 @@ public Identify(object messageId)
}

public object MessageId { get; private set; }

public override string ToString()
{
return "<Identify>: " + MessageId;
}
}

//response to the Identity message, get identity by Sender
Expand All @@ -52,6 +57,11 @@ public ActorIdentity(object messageId, ActorRef subject)

public object MessageId { get; private set; }
public ActorRef Subject { get; private set; }

public override string ToString()
{
return "<ActorIdentity>: " + Subject + " - MessageId=" + MessageId;
}
}

/// <summary>
Expand All @@ -62,7 +72,7 @@ public ActorIdentity(object messageId, ActorRef subject)
/// it processes the message, which gets handled using the normal supervisor mechanism, and
/// <see cref="IActorContext.Stop"/> which causes the actor to stop without processing any more messages. </para>
/// </summary>
public sealed class PoisonPill : AutoReceivedMessage
public sealed class PoisonPill : AutoReceivedMessage
{
private PoisonPill() { }
private static readonly PoisonPill _instance = new PoisonPill();
Expand All @@ -73,6 +83,11 @@ public static PoisonPill Instance
return _instance;
}
}

public override string ToString()
{
return "<PoisonPill>";
}
}


Expand All @@ -95,6 +110,11 @@ public static Kill Instance
return _instance;
}
}

public override string ToString()
{
return "<Kill>";
}
}


Expand All @@ -117,5 +137,10 @@ public AddressTerminated(Address address)
}

public Address Address { get; private set; }

public override string ToString()
{
return "<AddressTerminated>: " + Address;
}
}
}
24 changes: 24 additions & 0 deletions src/core/Akka/Dispatch/SysMsg/SystemMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public interface SystemMessage : NoSerializationVerificationNeeded
/// </summary>
public sealed class NoMessage : SystemMessage
{
public override string ToString()
{
return "NoMessage";
}
}

/// <summary>
Expand Down Expand Up @@ -253,6 +257,11 @@ public CompleteTask(AmbientState state, Action action)
/// </summary>
/// <value>The set result.</value>
public Action SetResult { get; private set; }

public override string ToString()
{
return "CompleteTask - AmbientState: " + State;
}
}

/// <summary>
Expand Down Expand Up @@ -337,6 +346,11 @@ public static Suspend Instance
return _instance;
}
}

public override string ToString()
{
return "<Suspend>";
}
}

/// <summary>
Expand All @@ -353,6 +367,11 @@ public static Stop Instance
return _instance;
}
}

public override string ToString()
{
return "<Stop>";
}
}

/// <summary>
Expand Down Expand Up @@ -424,6 +443,11 @@ public static Terminate Instance
return _instance;
}
}

public override string ToString()
{
return "<Terminate>";
}
}

public sealed class Create : SystemMessage
Expand Down
5 changes: 5 additions & 0 deletions src/core/Akka/Dispatch/TaskDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class AmbientState
public ActorRef Self { get; set; }
public ActorRef Sender { get; set; }
public object Message { get; set; }

public override string ToString()
{
return string.Format("(Sender: {0}, Self: {1}, Message: {2})", Sender, Self, Message);
}
}

public class ActorTaskScheduler : TaskScheduler
Expand Down

3 comments on commit 85d217f

@Petabridge-CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Akka.NET :: Akka.NET PR Build Build 77 is now running

@Petabridge-CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Akka.NET :: Akka.NET PR Build Build 77 outcome was FAILURE
Summary: System.Exception: xUnit failed for the following assemblies: D:\BuildAgent\work\49b164d63843fb4\src\core\Akka.Persistence.Tests\bin\Release\Akka.Persistence.Tests.dll, D:\BuildAgent\work\49b164d63843fb4\src\core\Akka.Tests\bin\Release\Akka.Tests.dll ... Build time: 00:09:28

Failed tests

Akka.Persistence.Tests.dll: Akka.Persistence.Tests.GuaranteedDeliveryCrashSpec.GuaranteedDelivery_should_not_send_when_actor_crashes: <no details avaliable>

Akka.Tests.dll: Akka.Tests.Routing.TailChoppingSpec.Tail_chopping_router_must_throw_exception_if_no_result_will_arrive_within_the_given_time: <no details avaliable>

@HCanber
Copy link
Contributor Author

@HCanber HCanber commented on 85d217f Mar 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh. Did I break something?
According to #695 (comment) it was a success, but the merge then failed anyway? Or how is this to be understood?

Please sign in to comment.