Lightweight Java State Machine