读书人

SimpleDateFormat线程安全有关问题

发布时间: 2014-01-23 14:48:04 作者: rapoo

SimpleDateFormat线程安全问题

    private static ThreadLocal<DateFormat> threadLocalSDF = new ThreadLocal<DateFormat>();    public static DateFormat getShortDateFormat() {        DateFormat df = threadLocalSDF.get();        if (df == null) {            df = new SimpleDateFormat("yyMMdd");            threadLocalSDF.set(df);        }        return df;    }

读书人网 >其他相关

热点推荐