![]() |
Note the text only slides contain a clearer view of the code fragement.
Finally some code examples! They might be small, but they are gems after all.
Coding up a large number of exception handlers seemed counter-productive, so I broke the problem into three parts:
Fatal unknown errors.
Errors arising from sort of session failure.
Errors that arise when we lose the connection to the database or mainframe.
I originally wanted to differentiate between session and connection failures, to do session auto-recovery. However, in practice I found a session failure was difficult to recover from. A zillion reasons might exist why that SQL command we issued failed, or how come I got that funny IMS Message.
We dropped smart session recovery, but I left the logic in just in case... Simply put, its initialization, process until told to stop, then disconnect. If any thing bad happens, disconnect and restart.
Garbage Collection, and finalization are marvelous ways of cleaning up the muck after a failure. In practice no leaks at any of the interface points. Forking at a user background priority allowed me to use the development environment without performance problems. The application cheerfully churns in the background while I inspect in the foreground.