ThreadSafe : java.text.SimpleDateFormat vs. com.thoughtworks.xstream.core.util.ThreadSafeSimpleDateFormat
public static String formatDateStr (Date date) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatDateStr(date, simpleDateFormat);
}
public static String formatDateStrThreadSafe (Date date) {
ThreadSafeSimpleDateFormat format = new ThreadSafeSimpleDateFormat("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("UTC"), 0, 5, false);
return format.format(date);
}