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...