From bad2718b1b85d806221fce52c76fa1d388993396 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Wed, 7 Dec 2016 18:53:37 +0700 Subject: singleton java 8 date formatters --- juick-www/src/main/java/com/juick/www/RSS.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'juick-www/src/main/java/com') diff --git a/juick-www/src/main/java/com/juick/www/RSS.java b/juick-www/src/main/java/com/juick/www/RSS.java index a343d13b..91ba9380 100644 --- a/juick-www/src/main/java/com/juick/www/RSS.java +++ b/juick-www/src/main/java/com/juick/www/RSS.java @@ -19,6 +19,7 @@ package com.juick.www; import com.juick.Message; import com.juick.server.MessagesQueries; +import com.juick.util.DateFormattersHolder; import com.juick.util.MessageUtils; import com.mitchellbosecke.pebble.error.PebbleException; import com.mitchellbosecke.pebble.template.PebbleTemplate; @@ -28,7 +29,6 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; -import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,8 +39,6 @@ import java.util.Map; */ public class RSS { - private static final SimpleDateFormat sdfRSS = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); - protected void doGet(JdbcTemplate sql, HttpServletResponse response, int uid) throws ServletException, IOException, PebbleException { List mids = MessagesQueries.getUserBlog(sql, uid, 0, 0); if (mids.isEmpty()) { @@ -58,7 +56,7 @@ public class RSS { Map context = new HashMap<>(); context.put("user", msgs.stream().findFirst().get().getUser()); context.put("msgs", msgs); - context.put("sdfRSS", sdfRSS); + context.put("sdfRSS", DateFormattersHolder.getRssFormatterInstance()); template.evaluate(out, context); } } -- cgit v1.2.3