赞
踩
- public class SysVisitRecordScheduler extends AbstractScheduler {
-
- private static ThreadLocal<List<String>> logHolder1 = new ThreadLocal<>();
-
- // private static final TransmittableThreadLocal<String> threadLocal = new TransmittableThreadLocal<>();
-
- private static InheritableThreadLocal<List<String>> logHolder = new InheritableThreadLocal<>();
-
- @Override
- protected ProcessResult innerProcess(JobContext jobContext) {
- log.info("SysVisitRecordJob {} start execute", jobContext.getJobName());
- String noticeWorkNos = jobContext.getJobParameters();
- if (StringUtils.isBlank(noticeWorkNos)) {
- return new ProcessResult(true, "success");
- }
- try {
- return new ProcessResult(true, "success");
- } catch (Exception e) {
- log.error("SysVisitRecordJob execute fail: ", e);
- return new ProcessResult(false, e.getMessage());
- }
- }
-
- public static void main(String[] args) {
- logHolder.set(Lists.newArrayList("test"));
- List<String> list1 = logHolder.get();
- System.out.println(list1);
- CompletableFuture.runAsync(() -> {
- List<String> list2 = logHolder.get();
- System.out.println(list2);
- });
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。