Code cleanup

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1713455 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2015-11-09 15:08:20 +00:00
parent 6ab2c32970
commit 70e603f819
1 changed files with 2 additions and 4 deletions

View File

@ -199,8 +199,7 @@ public final class DateUtils {
*/ */
final static class DateFormatHolder { final static class DateFormatHolder {
private static final ThreadLocal<SoftReference<Map<String, SimpleDateFormat>>> private static final ThreadLocal<SoftReference<Map<String, SimpleDateFormat>>> THREADLOCAL_FORMATS = new ThreadLocal<>();
THREADLOCAL_FORMATS = new ThreadLocal<>();
/** /**
* creates a {@link SimpleDateFormat} for the requested format string. * creates a {@link SimpleDateFormat} for the requested format string.
@ -219,8 +218,7 @@ public final class DateUtils {
Map<String, SimpleDateFormat> formats = ref == null ? null : ref.get(); Map<String, SimpleDateFormat> formats = ref == null ? null : ref.get();
if (formats == null) { if (formats == null) {
formats = new HashMap<>(); formats = new HashMap<>();
THREADLOCAL_FORMATS.set( THREADLOCAL_FORMATS.set(new SoftReference<>(formats));
new SoftReference<>(formats));
} }
SimpleDateFormat format = formats.get(pattern); SimpleDateFormat format = formats.get(pattern);