From a019399c3c0bbfd75c14bd6e4cc8e78d612b0d10 Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Fri, 25 Jun 2004 17:21:41 +0000
Subject: [PATCH] reduce synchronization on static (instead use per context
 objects, for large sims)

---
 router/java/src/net/i2p/router/MessageHistory.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/router/java/src/net/i2p/router/MessageHistory.java b/router/java/src/net/i2p/router/MessageHistory.java
index 8dac02beb8..bcf3e7f9ec 100644
--- a/router/java/src/net/i2p/router/MessageHistory.java
+++ b/router/java/src/net/i2p/router/MessageHistory.java
@@ -42,9 +42,13 @@ public class MessageHistory {
     /** config property determining where we want to log the message history, if we're keeping one */
     public final static String PROP_MESSAGE_HISTORY_FILENAME = "router.historyFilename";
     public final static String DEFAULT_MESSAGE_HISTORY_FILENAME = "messageHistory.txt";
-    
+
+    private final SimpleDateFormat _fmt;
+
     public MessageHistory(RouterContext context) {
         _context = context;
+         _fmt = new SimpleDateFormat("yy/MM/dd.HH:mm:ss.SSS");
+        _fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
         _reinitializeJob = new ReinitializeJob();
         _writeJob = new WriteJob();
         _submitMessageHistoryJob = new SubmitMessageHistoryJob(_context);
@@ -441,11 +445,7 @@ public class MessageHistory {
         return buf.toString();
     }
     
-    private final static SimpleDateFormat _fmt = new SimpleDateFormat("yy/MM/dd.HH:mm:ss.SSS");
-    static {
-        _fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
-    }
-    private final static String getTime(Date when) {
+    private final String getTime(Date when) {
         synchronized (_fmt) {
             return _fmt.format(when);
         }
-- 
GitLab