“Java DateFormat is not threadsafe” what does this leads to?
Let’s try it out. Here is a program in which multiple threads use a shared SimpleDateFormat. Program: public static void main(String[] args) throws Exception { final DateFormat format = new SimpleDateFormat(“yyyyMMdd”); Callable<Date> task = new Callable<Date>(){ public Date call() throws Exception { return format.parse(“20101022”); } }; //pool with 5 threads ExecutorService exec = Executors.newFixedThreadPool(5); List<Future<Date>> … Read more