Question

I'm maintaining a couple of actor-based Scala applications at the moment, and one question I find myself asking all the time is Who sends that message?

For example, I find the piece of code that prints the scary message I found in the logs:

case ReportFailedUpdates(stuff) =>
  log("The horror! The horror! " + stuff)
  dieHorribly()

and I want to find out what might be the cause. If I weren't using actors, I could hit Ctrl+Alt+H (at least in Eclipse) and find out who 'called' this 'method' (and who called that, and who called that). With actors, I find myself searching for ! ReportFailedUpdates( to find which actors send this message, then searching for the senders of the message that actor was reacting to, etc (and usually drawing the result on paper). This has two disadvantages:

  • It's slower, since Eclipse is doing a text search over the (potentially many) project(s) and I'm having to note stuff down
  • It doesn't necessarily find all occurrences, since maybe this was sent with !?, or maybe someone put two spaces between the ! and the ReportFailedUpdates, or, or, or....

What I'd love is some tooling support that lets me find out where a message could have come from - roughly the equivalent of a call hierarchy for non-actor-based code.

Are there any tools that do it? Is this a feature of the ScalaIDE for Eclipse that I just haven't discovered? If I use IntelliJ will my life be better?

Update

My example may have been misleading. This isn't just about figuring out what's gone wrong when it all falls over - I also find myself doing this a lot when I pick up a new system and need to figure out how it works. Seems like there isn't yet a tool to do it. Guess I'll have to have a think myself about how you could start to statically extract (and maybe visualize) the message flow graph...

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top