From ec0ff8da867a59035c043bd8f29eb31e98b6d764 Mon Sep 17 00:00:00 2001 From: paopaofish <994987301@qq.com> Date: Tue, 22 Oct 2019 23:10:10 +0800 Subject: [PATCH] Using non-final variables to lock can cause thread-safety problems.According to my understanding, it is appropriate to add the final keyword here --- xxl-job-core/src/main/java/com/xxl/job/core/util/DateUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/DateUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/DateUtil.java index 9d7016ce..5a8f523c 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/DateUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/DateUtil.java @@ -24,7 +24,7 @@ public class DateUtil { private static final String DATE_FORMAT = "yyyy-MM-dd"; private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - private static ThreadLocal> dateFormatThreadLocal = new ThreadLocal>(); + private static final ThreadLocal> dateFormatThreadLocal = new ThreadLocal>(); private static DateFormat getDateFormat(String pattern) { if (pattern==null || pattern.trim().length()==0) { throw new IllegalArgumentException("pattern cannot be empty.");