javaworld近日有一篇文章的標題是 "J2ee中的異常治理和錯誤追循",根據文章中提到的,It "PRovides the basis for developing a set of policies along with a supporting framework for error handling in the J2EE world"..
作者提到了一個概念叫 application-wide user session - 一種可以適用于多個layers的session,比如,web 應用, EJBs, EIS modules,其他 J2EE 組件。
2. Encapsulate error handling and install a handler on top of each tier.. 在一個安全的網絡環境下,你將可以專注于business layer的異常處理。而hander將會處理剩下的異常:比如 logging, system management notification, transformations 等....
3.Model the exception hierarchy using a "simple living" approach..不要在發現一種新的異常的時候,就創建一個新的exception 類型,你要首先問問自己,你是不是僅僅是碰到了某種異常的變種,然后,用戶是否能夠處理你創建的異常類型...記住,異常也是objects,在某種意義上來講,異常的屬性, 已經可以描述不同形勢下的情況...
這些的實現,都是存在一系列假設前提的,比如:an application-wide session, aspects as exception wrappers, and the doctrine of unchecked exceptions, increasingly common among Java developers...