@Autowired
@Qualifier("schedulingTaskScheduler")
private TaskScheduler taskScheduler;
taskScheduler.schedule(new Runnable() {
@Override
public void run() {
Span span = null;
try {
span = tracer.createSpan("組件名:業務名");
//dosomething
} catch (BusinessException e) {
log.info("buzErr code={},msg={}", e.getCode(), e.getMessage());
}catch (Exception e) {
log.error("err",e);
} finally{
if (span != null) {
tracer.close(span);
}
}
}
}, endTime);
複製代碼