Hey!

I've been using SCXML and it's really nice. I had some problems with timers 
though - I just couldn't quite do what I needed to do, so I wrote some extra 
scheduler classes. They turned out to be REALLY helpful so I thought I might 
contribute them back if you thought anyone else could use them.

I've never contributed to Apache Commons before so please bear with me if I am 
doing this all wrong.

The classes I wrote were for replaying events and testability. I had a series 
of events and I wanted to replay them - this is great for unit testing and also 
let me change the state machine and replay the events and see what happened. 
But timers threw this off - if a timer started, I had no idea when in the 
sequence of following events the timer would trigger. Therefore one timer class 
I wrote is for replaying events - you have to tell the replay class what time 
it is supposed to be, and it'll fire off any timer events that should have 
fired. This let me take two or three days of things and replay them almost 
immediately, which gives me a lot of very useful abilities. I know when each 
event happened, so I can just register the time and fire the event and all 
timers behave just like they should.

The other timer class I wrote just extended SimpleScheduler. I need reporting, 
and there are times when things are waiting on a timer to fire - but I can't 
tell that as I couldn't see what timers are present or when they'll fire. So I 
couldn't report on them, nor could I unit test this. So I wrote an extension of 
SimpleScheduler that just lets me see that information. SimpleScheduler uses a 
java timer class that ALSO doesn't let you see any of that information, thus I 
couldn't really do this quite the way I hoped, but every time you start a timer 
this just tracks when it will fire off and lets you query on it.

Would these classes be suitable to share back?

And if so I noticed that Apache Commons SCXML doesn't use JodaTime. I'm going 
to guess I need to rewrite the classes not to use JodaTime before submitting 
them, but I figured that was worth asking about!



Evan Reynolds
Software Engineer - Server Development | MTN
evan.reyno...@mtnsat.com<mailto:evan.reyno...@mtnsat.com> | 
www.mtnsat.com<http://www.mtnsat.com/>
+1.206.838.7700 main | +1.206.838.7708 fax
101 Stewart Street Suite 800 | Seattle, WA 98101 USA

[cid:242C1268-CDA6-445B-9644-4BDAD3D77FB0]

Reply via email to