执行器
执行器是最接近用户的,需要用户实现执行器接口去执行任务,以下代码来自 Open-Job
@Slf4j
@Component
public class ScheduleJobExecutor implements ScheduleTaskExecutor {
private final OpenJobClientService openJobClientService;
public ScheduleJobExecutor(OpenJobClientService openJobClientService) {
this.openJobClientService = openJobClientService;
}
@Override
public void execute(List<Long> taskList) {
if (CollectionUtils.isEmpty(taskList)){
return;
}
taskList.forEach(taskId-> {
try {
openJobClientService.invoke(taskId);
}catch (Exception e){
log.error(e.getMessage(), e);
}
});
}
}