This commit is contained in:
jrandom
2004-06-25 17:09:55 +00:00
committed by zzz
parent f6d38dd5e0
commit 983d258bce
3 changed files with 35 additions and 12 deletions

View File

@ -59,7 +59,9 @@ class PoolingTunnelSelector {
for (Iterator iter = ordered.iterator(); iter.hasNext() && (rv.size() < criteria.getMinimumTunnelsRequired()); ) { for (Iterator iter = ordered.iterator(); iter.hasNext() && (rv.size() < criteria.getMinimumTunnelsRequired()); ) {
rv.add(iter.next()); 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; return rv;
} }
@ -79,7 +81,9 @@ class PoolingTunnelSelector {
if (info.getIsReady()) { if (info.getIsReady()) {
tunnels.add(id); tunnels.add(id);
} else { } 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()); ) { for (Iterator iter = ordered.iterator(); iter.hasNext() && (rv.size() < criteria.getMinimumTunnelsRequired()); ) {
rv.add(iter.next()); 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; return rv;
} }
@ -115,7 +121,10 @@ class PoolingTunnelSelector {
if (info.getSettings() == null) return true; if (info.getSettings() == null) return true;
if (info.getSettings().getExpiration() <= 0) return true; if (info.getSettings().getExpiration() <= 0) return true;
if (info.getSettings().getExpiration() - safetyMargin <= _context.clock().now()) { 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; return true;
} else { } else {
return false; return false;

View File

@ -300,8 +300,9 @@ class TestTunnelJob extends JobImpl {
StringBuffer buf = new StringBuffer(256); StringBuffer buf = new StringBuffer(256);
buf.append(super.toString()); buf.append(super.toString());
buf.append(": TestMessageSelector: tunnel ").append(_tunnelId); buf.append(": TestMessageSelector: tunnel ").append(_tunnelId);
buf.append(" looking for ").append(_id).append(" expiring on "); buf.append(" looking for ").append(_id).append(" expiring in ");
buf.append(new Date(_expiration)); buf.append(_expiration - _context.clock().now());
buf.append("ms");
return buf.toString(); return buf.toString();
} }
} }

View File

@ -58,10 +58,15 @@ class TunnelPoolExpirationJob extends JobImpl {
TunnelInfo info = _pool.getFreeTunnel(id); TunnelInfo info = _pool.getFreeTunnel(id);
if ( (info != null) && (info.getSettings() != null) ) { if ( (info != null) && (info.getSettings() != null) ) {
if (info.getSettings().getExpiration() < expire) { 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); _pool.removeFreeTunnel(id);
} else if (info.getSettings().getExpiration() < now) { } 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); info.setIsReady(false);
} }
} }
@ -81,10 +86,14 @@ class TunnelPoolExpirationJob extends JobImpl {
TunnelInfo info = _pool.getOutboundTunnel(id); TunnelInfo info = _pool.getOutboundTunnel(id);
if ( (info != null) && (info.getSettings() != null) ) { if ( (info != null) && (info.getSettings() != null) ) {
if (info.getSettings().getExpiration() < expire) { 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); _pool.removeOutboundTunnel(id);
} else if (info.getSettings().getExpiration() < now) { } 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); info.setIsReady(false);
} }
} }
@ -104,7 +113,9 @@ class TunnelPoolExpirationJob extends JobImpl {
TunnelInfo info = _pool.getParticipatingTunnel(id); TunnelInfo info = _pool.getParticipatingTunnel(id);
if ( (info != null) && (info.getSettings() != null) ) { if ( (info != null) && (info.getSettings() != null) ) {
if (info.getSettings().getExpiration() < expire) { 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); _pool.removeParticipatingTunnel(id);
} }
} }
@ -124,7 +135,9 @@ class TunnelPoolExpirationJob extends JobImpl {
TunnelInfo info = _pool.getPendingTunnel(id); TunnelInfo info = _pool.getPendingTunnel(id);
if ( (info != null) && (info.getSettings() != null) ) { if ( (info != null) && (info.getSettings() != null) ) {
if (info.getSettings().getExpiration() < expire) { 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); _pool.removePendingTunnel(id);
} }
} }