首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

SimpleDateFormat线程安全有关问题

2014-01-23 
SimpleDateFormat线程安全问题private static ThreadLocalDateFormat threadLocalSDF new ThreadLocal

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;    }

热点排行