Added More Fault Tolerance to Ticker Plants
Wednesday, January 26th, 2011This afternoon I've been working on adding a bunch more fault tolerance to my ticker plants. I had a problem one time with the SIAC symbol mapping data coming out of the configuration service. It should have been a simple JSON map with strings for keys and values, but for some reason, one of the elements wasn't a string. Exception.
So I added in the test for the data types and if they aren't strings, I log it and move on. Had another one where the configuration service didn't return sufficient data for properly configuring a UDP receiver. It then got stuck in a very tight loop that logged a message saying it was retrying, and soon filled up the disk!
That one took a little more effort, but it's all about checking and re-checking to make sure that things are self-consistent. It's not rocket science, but it's hard to predict these problems, and that's why I like to just watch the application run and see what the real world has to offer in terms of problems.
Finally, I added one nice thing to my lisp-like parser. The java version has the functions cond and merge that offer conditional behavior like an if/then but a little more flexible. The cond takes pairs of arguments organized as a predicate and an action. The evaluation of the cond starts with the first predicate - if it evaluates to true then the corresponding action is evaluated and that is the return value for the cond. It's a simple switch statement.
The merge is like an OR union. Every predicate is evaluated, and if it evaluates to true, the corresponding action is OR-ed with the result of the merge. This is more like a filter.
Both are interesting and I really enjoyed adding them to the parser. Now I just need to get to the project where this parser is going to be used.