连击 天
fork: star:
波总,还有一个问题想请教一下,我现在使用QuartzPlugin,以下是YdzJob类的代码,在Job类里面抛出的异常能被全局异常拦截器抓到吗?
public class YdzJob implements Job {
private static Logger log = LoggerFactory.getLogger(YdzJob.class);
public void execute(JobExecutionContext arg0) throws JobExecutionException {
log.info("------调度任务【Ydz】启动------" + DateUtil.curDate());
try {
QuartzService.me.exec(QuartzService.SchedType.YDZ); //这里抛出异常能被全局异常拦截器抓到吗?
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
log.info("------调度任务【Ydz】结束------" + DateUtil.curDate());
}
}
这是我的拦截器代码
package com.icss.interceptor;
import com.icss.service.LogService;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
public class ExceptionInterceptor implements Interceptor {
@Override
public void intercept(Invocation inv) {
try {
inv.invoke();
} catch (Exception e) {
String excpMsg=e.getMessage();
//System.out.println("进来了");
LogService.me.logFailure(null, null, null, excpMsg);
}
}
}
没有更多内容
加载失败,请刷新页面
文章删除后无法恢复,确定删除此文章吗?
动弹删除后,数据将无法恢复
评论删除后,数据将无法恢复