EditContentFunction is not thread-safe because of using SimpleDateFormat in class variables.
We should do like in SolrIndexer class :
private static final ThreadLocal<SimpleDateFormat> __DATE_FORMAT = new ThreadLocal<>(); public static SimpleDateFormat dateFormat() { if (__DATE_FORMAT.get() == null) { __DATE_FORMAT.set(new SimpleDateFormat("yyyy-MM-dd")); } return __DATE_FORMAT.get(); }
Then use dateFormat() instead of DATE_FORMAT.
If we have two threads using DATE_FORMAT at the same time, we get an exception.
- Fait partie de
-
RUNTIME-2437 SimpleDateFormat should not be instanced in class variables
- Open