解决多线程下simpleDateFormat的安全问题

// 日期格式化
	private static final ThreadLocal<SimpleDateFormat> GMT_FORMATERS = new ThreadLocal<SimpleDateFormat>() {
		protected SimpleDateFormat initialValue() {
			SimpleDateFormat gmtFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH);
			gmtFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
			return gmtFormat;
		}
	};

 

posted on 2014-05-29 12:47  zhaofeng555  阅读(363)  评论(0编辑  收藏  举报