Tungsten FSM: A lightweight Java finite state machine library

I recently came across Tungsten FSM whilst looking for an off the shelf FSM implementation. Ideally I was looking for something which was a lightweight and no-frills but robust FSM implementation, and Tungsten FSM seemed to exactly fit the bill. All configuration is done in code, so no messing around with XML files, and the implementation itself is only a handful of classes with only one dependency (log4j).

All in all worked out very well, and it seems to do exactly what it promises. The support for sub-states is useful to cut down on config bloat by defining common transitions on a parent state.

If I were to nitpick it would have been nice to see generics used to avoid needing to cast the entities/events, however this would arguably bloat the Tungsten source somewhat. It would have also been nice to be able to specify an “ignore” type transition which could be specified on a parent state to ignore an event rather than having to define transitions on all sub states of the parent state for an event in order to ignore it and stay in the same state.

One Comment

  1. Posted October 6, 2011 at 9:41 pm | Permalink

    Hi James, I just noticed this post. I’m glad FSM worked for you and wanted to say that the FSM code has migrated to the Tungsten Replicator project on code.google.com. I have updated the capabilities somewhat to support cancel operations on state machines, which turned out to be necessary in our work. The project URL is http://code.google.com/p/tungsten-replicator.

    Cheers, Robert