创建异常对象时会调用父类Throwable的fillInStackTrace()方法生成栈追踪信息,这部分对系统性能开销很大。JDk7开始 异常类增加了爬栈开关,这里同样增加构造方法方便根据业务情况自定义是否关闭和打开

This commit is contained in:
zhaolongbo 2021-08-26 22:28:41 +08:00
parent ea976bc25b
commit 40a6ffbea0
4 changed files with 16 additions and 0 deletions

View File

@ -27,6 +27,10 @@ public class DependencyException extends RuntimeException {
super(message, throwable);
}
public DependencyException( String message, Throwable throwable,boolean enableSuppression,boolean writableStackTrace) {
super(message, throwable,enableSuppression,writableStackTrace);
}
public DependencyException(Throwable throwable, String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
}

View File

@ -26,6 +26,10 @@ public class NotInitedException extends RuntimeException {
super(message, throwable);
}
public NotInitedException( String message, Throwable throwable,boolean enableSuppression,boolean writableStackTrace) {
super(message, throwable,enableSuppression,writableStackTrace);
}
public NotInitedException(Throwable throwable, String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
}

View File

@ -33,6 +33,10 @@ public class StatefulException extends RuntimeException {
super(msg, throwable);
}
public StatefulException( String message, Throwable throwable,boolean enableSuppression,boolean writableStackTrace) {
super(message, throwable,enableSuppression,writableStackTrace);
}
public StatefulException(int status, String msg) {
super(msg);
this.status = status;

View File

@ -25,6 +25,10 @@ public class UtilException extends RuntimeException{
super(message, throwable);
}
public UtilException( String message, Throwable throwable,boolean enableSuppression,boolean writableStackTrace) {
super(message, throwable,enableSuppression,writableStackTrace);
}
public UtilException(Throwable throwable, String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
}