⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib0026.html

📁 j2ee架构师手册
💻 HTML
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Error-Handling Requirements</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0025.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0027.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch04"></a>
<div class="section">
<h2 class="first-section-title"><a name="116"></a><a name="ch04lev1sec3"></a>Error-Handling Requirements</h2><a name="117"></a><a name="IDX-42"></a>
<p class="para">Error-handling requirements need to be discussed, documented, and agreed to just as thoroughly as data formats do. Bad error handling will lead to high maintenance costs.</p>
<div class="section">
<h3 class="sect3-title">
<a name="118"></a><a name="ch04lev2sec5"></a>Error Notification Procedures</h3>
<p class="first-para">
<b class="bold">All external application interfaces should have error notification procedures. </b>Some organizations provide centralized operations personnel responsible for notifying application support personnel of errors. This is often achieved through some type of console message. It's not uncommon for the console to be monitored 24x7x365. It's normal for organizations with this capability to provide some way to programmatically generate a console message that someone takes action on.</p>
<p class="para">
<b class="bold">Use mechanical error notification.</b> In companies that haven't established enterprise-wide error notification procedures, I typically include some type of e-mail notification for severe system errors. Merely writing errors to a log assumes that someone will look at them. Most messages written to the log often go unnoticed. As most alphanumeric pagers accept messages via e-mail, it's easy to include pager notification for severe errors. This should be used with caution for obvious reasons.</p>
<p class="para">
<b class="bold">Don't be afraid to be verbose when logging for errors.</b> My philosophy is that the error log should contain as much information as possible. While some of it might not be useful for a particular problem, it's better to have too much than too little when it comes to information. If logging is successful, a large percentage of errors should be diagnosable just from the error message without further need to reproduce the problem.</p>
<p class="last-para">At some companies, commercial tool support is available to help with logging. BMC Patrol, EcoTools, and Tivoli are commercial network management toolsets that are often used to monitor the enterprise. OpenNMS (<a target="_top" class="url" href="http://www.opennms.org/">http://www.opennms.org/</a>) is an open source alternative for network management.</p>
</div>
<div class="section">
<h3 class="sect3-title">
<a name="119"></a><a name="ch04lev2sec6"></a>Retry Procedures</h3>
<p class="first-para">Once initial development is complete, most errors with interfaces have environmental causes. Examples include someone recycling the database or messaging software, someone tripping over a network cord, and a server with a full file system. In most cases, the error is eventually fixed and the application interface resumes proper function.</p>
<a name="120"></a><a name="IDX-43"></a>
<p class="para">However, with most applications, some type of recovery or retransmission procedure must be performed for the transmissions that failed. For example, messages recording customer purchases from the ordering application must be resent to keep accounting records accurate.</p>
<p class="para">
<b class="bold">Make retry procedures mechanical.</b> For transmissions that a user isn't physically waiting for, I often put a scheme for automatic retry logic in place. Environmental problems occur often enough in most companies to warrant including selective retry logic to recover from outages more quickly and with less effort. The objective of the retry mechanism is to automatically recover from a temporary outage without manual intervention by an application administrator.</p>
<p class="para">The potential for complexity lies in discriminating between temporary outages and errors that won't magically go away over time. It's possible to take a shotgun approach and assume that all errors occur as a result of a temporary outage and initiate retry logic. You should use this approach with care.</p>
<p class="last-para">
<b class="bold">All mechanical retry logic should have limits.</b> It's important not to retry forever, essentially creating an infinite loop. Choose a sensible retry interval and number of retry attempts. It's also wise to make these limits configurable so they can be easily adjusted. Retry attempts should also be logged or possibly follow your mechanical notification procedure. Upon receiving notification of the retries, an application administrator might realize that corrective action should be taken.</p>
</div>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0025.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0027.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -