From 51e259c1984bdea6953992a5ffb414f91c0b0ca0 Mon Sep 17 00:00:00 2001 From: jrandom Date: Sat, 19 Jun 2004 23:32:41 +0000 Subject: [PATCH] avoiding the String.getBytes() since its a bitch on gc (measured for this situation) --- core/java/src/net/i2p/data/RoutingKeyGenerator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/data/RoutingKeyGenerator.java b/core/java/src/net/i2p/data/RoutingKeyGenerator.java index 0f14495ca..c20b5779a 100644 --- a/core/java/src/net/i2p/data/RoutingKeyGenerator.java +++ b/core/java/src/net/i2p/data/RoutingKeyGenerator.java @@ -80,10 +80,15 @@ public class RoutingKeyGenerator { today = _cal.getTime(); } byte mod[] = null; + String modVal = null; synchronized (_fmt) { - mod = _fmt.format(today).getBytes(); + modVal = _fmt.format(today); } - _log.info("Routing modifier generated: " + new String(mod)); + mod = new byte[modVal.length()]; + for (int i = 0; i < modVal.length(); i++) + mod[i] = (byte)(modVal.charAt(i) & 0xFF); + if (_log.shouldLog(Log.INFO)) + _log.info("Routing modifier generated: " + modVal); setModData(mod); }