fix(tenant): 修复多租户定时任务执行结果为空时的异常
- 针对执行结果为 null 的情况增加了日志记录 - 为了避免 ConcurrentHashMap put空指针异常,将 result 设置为空字符串
This commit is contained in:
@@ -50,6 +50,12 @@ public class TenantJobAspect {
|
|||||||
TenantUtils.execute(tenantId, () -> {
|
TenantUtils.execute(tenantId, () -> {
|
||||||
try {
|
try {
|
||||||
Object result = joinPoint.proceed();
|
Object result = joinPoint.proceed();
|
||||||
|
if(null == result){
|
||||||
|
XxlJobHelper.log(StrUtil.format("[多租户({}) 执行任务({}),结果为:null]",
|
||||||
|
tenantId, joinPoint.getSignature()));
|
||||||
|
//避免ConcurrentHashMap put空指针异常
|
||||||
|
result = "";
|
||||||
|
}
|
||||||
results.put(tenantId, StrUtil.toStringOrEmpty(result));
|
results.put(tenantId, StrUtil.toStringOrEmpty(result));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));
|
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));
|
||||||
|
|||||||
Reference in New Issue
Block a user