diff --git a/router/java/src/net/i2p/router/tunnelmanager/PoolingTunnelSelector.java b/router/java/src/net/i2p/router/tunnelmanager/PoolingTunnelSelector.java index 3b8876c01..396d16a3a 100644 --- a/router/java/src/net/i2p/router/tunnelmanager/PoolingTunnelSelector.java +++ b/router/java/src/net/i2p/router/tunnelmanager/PoolingTunnelSelector.java @@ -59,7 +59,9 @@ class PoolingTunnelSelector { for (Iterator iter = ordered.iterator(); iter.hasNext() && (rv.size() < criteria.getMinimumTunnelsRequired()); ) { rv.add(iter.next()); } - _log.info("Selecting outbound tunnelIds [all outbound tunnels: " + outIds.size() + ", tunnelIds ready: " + ordered.size() + ", rv: " + rv + "]"); + if (_log.shouldLog(Log.INFO)) + _log.info("Selecting outbound tunnelIds [all outbound tunnels: " + outIds.size() + + ", tunnelIds ready: " + ordered.size() + ", rv: " + rv + "]"); return rv; } @@ -79,7 +81,9 @@ class PoolingTunnelSelector { if (info.getIsReady()) { tunnels.add(id); } else { - _log.debug("Inbound tunnel " + id + " is not ready?! " + new Date(info.getSettings().getExpiration())); + if (_log.shouldLog(Log.DEBUG)) + _log.debug("Inbound tunnel " + id + " is not ready?! " + + new Date(info.getSettings().getExpiration())); } } @@ -88,7 +92,9 @@ class PoolingTunnelSelector { for (Iterator iter = ordered.iterator(); iter.hasNext() && (rv.size() < criteria.getMinimumTunnelsRequired()); ) { rv.add(iter.next()); } - _log.info("Selecting inbound tunnelIds [tunnelIds ready: " + tunnels.size() + ", rv: " + rv + "]"); + if (_log.shouldLog(Log.INFO)) + _log.info("Selecting inbound tunnelIds [tunnelIds ready: " + + tunnels.size() + ", rv: " + rv + "]"); return rv; } @@ -115,7 +121,10 @@ class PoolingTunnelSelector { if (info.getSettings() == null) return true; if (info.getSettings().getExpiration() <= 0) return true; if (info.getSettings().getExpiration() - safetyMargin <= _context.clock().now()) { - _log.debug("Expiration of tunnel " + id.getTunnelId() + " has almost been reached [" + new Date(info.getSettings().getExpiration()) + "]"); + if (_log.shouldLog(Log.DEBUG)) + _log.debug("Expiration of tunnel " + id.getTunnelId() + + " has almost been reached [" + + new Date(info.getSettings().getExpiration()) + "]"); return true; } else { return false; diff --git a/router/java/src/net/i2p/router/tunnelmanager/TestTunnelJob.java b/router/java/src/net/i2p/router/tunnelmanager/TestTunnelJob.java index 0a1cdaee2..f4dc2e99e 100644 --- a/router/java/src/net/i2p/router/tunnelmanager/TestTunnelJob.java +++ b/router/java/src/net/i2p/router/tunnelmanager/TestTunnelJob.java @@ -300,8 +300,9 @@ class TestTunnelJob extends JobImpl { StringBuffer buf = new StringBuffer(256); buf.append(super.toString()); buf.append(": TestMessageSelector: tunnel ").append(_tunnelId); - buf.append(" looking for ").append(_id).append(" expiring on "); - buf.append(new Date(_expiration)); + buf.append(" looking for ").append(_id).append(" expiring in "); + buf.append(_expiration - _context.clock().now()); + buf.append("ms"); return buf.toString(); } } diff --git a/router/java/src/net/i2p/router/tunnelmanager/TunnelPoolExpirationJob.java b/router/java/src/net/i2p/router/tunnelmanager/TunnelPoolExpirationJob.java index 3a8712e41..f6af38d49 100644 --- a/router/java/src/net/i2p/router/tunnelmanager/TunnelPoolExpirationJob.java +++ b/router/java/src/net/i2p/router/tunnelmanager/TunnelPoolExpirationJob.java @@ -58,10 +58,15 @@ class TunnelPoolExpirationJob extends JobImpl { TunnelInfo info = _pool.getFreeTunnel(id); if ( (info != null) && (info.getSettings() != null) ) { if (info.getSettings().getExpiration() < expire) { - _log.info("Expiring free inbound tunnel " + id + " [" + new Date(info.getSettings().getExpiration()) + "] (expire = " + new Date(expire) + ")"); + if (_log.shouldLog(Log.INFO)) + _log.info("Expiring free inbound tunnel " + id + " [" + + new Date(info.getSettings().getExpiration()) + + "] (expire = " + new Date(expire) + ")"); _pool.removeFreeTunnel(id); } else if (info.getSettings().getExpiration() < now) { - _log.info("It is past the expiration for free inbound tunnel " + id + " but not yet the buffer, mark it as no longer ready"); + if (_log.shouldLog(Log.INFO)) + _log.info("It is past the expiration for free inbound tunnel " + id + + " but not yet the buffer, mark it as no longer ready"); info.setIsReady(false); } } @@ -81,10 +86,14 @@ class TunnelPoolExpirationJob extends JobImpl { TunnelInfo info = _pool.getOutboundTunnel(id); if ( (info != null) && (info.getSettings() != null) ) { if (info.getSettings().getExpiration() < expire) { - _log.info("Expiring outbound tunnel " + id + " [" + new Date(info.getSettings().getExpiration()) + "]"); + if (_log.shouldLog(Log.INFO)) + _log.info("Expiring outbound tunnel " + id + " [" + + new Date(info.getSettings().getExpiration()) + "]"); _pool.removeOutboundTunnel(id); } else if (info.getSettings().getExpiration() < now) { - _log.info("It is past the expiration for outbound tunnel " + id + " but not yet the buffer, mark it as no longer ready"); + if (_log.shouldLog(Log.INFO)) + _log.info("It is past the expiration for outbound tunnel " + id + + " but not yet the buffer, mark it as no longer ready"); info.setIsReady(false); } } @@ -104,7 +113,9 @@ class TunnelPoolExpirationJob extends JobImpl { TunnelInfo info = _pool.getParticipatingTunnel(id); if ( (info != null) && (info.getSettings() != null) ) { if (info.getSettings().getExpiration() < expire) { - _log.info("Expiring participation in tunnel " + id + " [" + new Date(info.getSettings().getExpiration()) + "]"); + if (_log.shouldLog(Log.INFO)) + _log.info("Expiring participation in tunnel " + id + " [" + + new Date(info.getSettings().getExpiration()) + "]"); _pool.removeParticipatingTunnel(id); } } @@ -124,7 +135,9 @@ class TunnelPoolExpirationJob extends JobImpl { TunnelInfo info = _pool.getPendingTunnel(id); if ( (info != null) && (info.getSettings() != null) ) { if (info.getSettings().getExpiration() < expire) { - _log.info("Expiring pending tunnel " + id + " [" + new Date(info.getSettings().getExpiration()) + "]"); + if (_log.shouldLog(Log.INFO)) + _log.info("Expiring pending tunnel " + id + " [" + + new Date(info.getSettings().getExpiration()) + "]"); _pool.removePendingTunnel(id); } }