- Make SimpleDateFormat produce wrong results on multiple threads
- Create Thread safe SimpleDateFormat
mvn exec:java
SimpleDateFormat without thrad safe checks
[ERROR] SimpleDateFormat thrown exception: java.util.concurrent.ExecutionException: java.lang.NumberFormatException: multiple points
ThreadSafe formatter
[OK] All dates are the same
- Creating ThreadLocal instance with SimpleDateFormat
ThreadLocal<DateFormat> threadDateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat(pattern));