惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 笨笨

UTF-8 Oracle生成MD5 How do you define Success? pbrun su -root Shell/Windows命令备忘 爸妈 What is ieHTTPHeaders? SLA(Service Level Agreement) Cluster/Fail-Over/Load Banlance Thread Dump 非常郁闷 Bea World 2005 materials available now 程序依赖库的管理 EJB琐碎的想法 J2EE的世界越来越精彩了 LDAP信息模型 人类进入文明史的标志 TimeZone Socket
Spring中的exception处理
笨笨 · 2006-01-03 · via 博客园 - 笨笨

exception.jpg

checkedexception.jpg

以上为Spring1.2的checked和非checked的exception的信息,
1. 观察Spring的RemoteAccessException,这个类的设计

可以解释为什么Spring可以把普通的Interface export as EJB acccess的方式(由于远程异常和本地异常处理的不一致,我不赞成EJB Object和LocalObject继承同一个classic interface,用Spring的这种处理方式倒是可以比较好的解决这个问题,唯一的不便的地方是变成Unchecked的exception了);
2. 观察Spring的RemoteAccessException的subclass,分为两种,RemoteConnectFailureExceptionRemoteLookupFailureException两种,分别代表了不能连接到EJB服务器连接成功但是lookup失败的情况,这个也是比较常用的一种区分方式,查看了一下它的判断标准:

 1 RmiClientInterceptorUtils:
 2 
 3     /**
 4      * Determine whether the given RMI exception indicates a connect failure.
 5      * Treats ConnectException, ConnectIOException, UnknownHostException,
 6      * NoSuchObjectException, StubNotFoundException, MarshalException and
 7      * UnmarshalException as connect failure.
 8      * @param ex the RMI exception to check
 9      * @return whether the exception should be treated as connect failure
10      * @see java.rmi.ConnectException
11      * @see java.rmi.ConnectIOException
12      * @see java.rmi.UnknownHostException
13      * @see java.rmi.NoSuchObjectException
14      * @see java.rmi.StubNotFoundException
15      * @see java.rmi.MarshalException
16      * @see java.rmi.UnmarshalException
17      */
18     public static boolean isConnectFailure(RemoteException ex) {
19         return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
20                 ex instanceof UnknownHostException ||
21                 ex instanceof NoSuchObjectException || ex instanceof StubNotFoundException ||
22                 ex instanceof MarshalException || ex instanceof UnmarshalException);
23     }