我偶然发现了下面的代码NestedRuntimeException中org.springframework.core:
static {
NestedExceptionUtils.class.getName();
}
Run Code Online (Sandbox Code Playgroud)
有这样一个块的用途是什么?
Ami*_*era 27
它将eagerly加载NestedExceptionUtils类以避免类加载器死锁.报告了一个错误(SPR-5607)"非平凡的NestedRuntimeException.getMessage()可能导致OSGi死锁",这是同一问题的解决方案.
编辑:
在源代码中也提到它作为注释.有关完整的源代码文档,请点击链接.这是NestedRuntimeException类的源代码的一部分.
static {
// Eagerly load the NestedExceptionUtils class to avoid classloader deadlock
// issues on OSGi when calling getMessage(). Reported by Don Brown; SPR-5607.
NestedExceptionUtils.class.getName();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
909 次 |
| 最近记录: |