GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltactivedata.com — 10.6. Handling Errors Guide to Performance and Customization10.6. Handling ErrorsError handling in application programs is always important to avoid incorrect or incomplete data modifications from occurring. However, it is even more important for compound procedures for three reasons:
One way to avoid irreconcilable changes is to avoid write operations in early stages of a compound procedure that are dependent on write operations that occur in later stages. However, even if two write operations are queued in the same stage there is no guarantee they will both succeed. So it is recommended to always check the response status of every call in the subsequent stage. In this case, the finish method might include the following code to handle potential issues: // stage 4
private void finish(ClientResponse[] resp) {
// Check the response status
String alert = "";
if (resp[0].getStatus() != ClientResponse.SUCCESS) {
alert += resp[0].getStatusString() + "\n";
}
if (resp[1].getStatus() != ClientResponse.SUCCESS) {
alert += resp[1].getStatusString() + "\n";
}
// Report any errors as part of the closure.
if (alert.length() > 0) {
abortProcedure(alert);
} else {
completeProcedure(1L);
}
}This is a fairly simplistic example; it does not do anything to correct the failure or address the case where there is no calling application to respond to the abort message. In actual business applications, additional code and additional stages might be necessary to requeue a failed insert or manually roll back a successful insert if its partner fails. Similarly, it may be necessary to write failure messages to a log file or other notification system for those cases where the procedure is invoked by an import connector. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |