diff options
author | 2018-11-01 13:03:27 +0300 | |
---|---|---|
committer | 2018-11-01 13:03:27 +0300 | |
commit | 406d72ea371b95e30be68a511b9c516b67d34fd3 (patch) | |
tree | 89ceade567d3db0601dd9987243c6ed97faa2eb4 /juick-common/src/main/java/com/juick/util/DateFormattersHolder.java | |
parent | ee4c1ef3b11d66129f64ca5361e9a7ef15779395 (diff) |
RFC1123 http date formatter (2DIGIT day-of-month)
Diffstat (limited to 'juick-common/src/main/java/com/juick/util/DateFormattersHolder.java')
-rw-r--r-- | juick-common/src/main/java/com/juick/util/DateFormattersHolder.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/juick-common/src/main/java/com/juick/util/DateFormattersHolder.java b/juick-common/src/main/java/com/juick/util/DateFormattersHolder.java index 09fd17d7..8292e68e 100644 --- a/juick-common/src/main/java/com/juick/util/DateFormattersHolder.java +++ b/juick-common/src/main/java/com/juick/util/DateFormattersHolder.java @@ -57,4 +57,19 @@ public class DateFormattersHolder { } return localInstance; } + + private static volatile DateFormatter httpDateFormatter; + + public static DateFormatter getHttpDateFormatter() { + DateFormatter localInstance = httpDateFormatter; + if (localInstance == null) { + synchronized (DateFormatter.class) { + localInstance = httpDateFormatter; + if (localInstance == null) { + httpDateFormatter = localInstance = new DateFormatter("EEE, dd MMM yyyy HH:mm:ss O"); + } + } + } + return localInstance; + } } |