From 916e328e10e127ae6f9049fb1f42e0f8ac636b45 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 24 Nov 2012 13:55:47 +0000 Subject: [PATCH] javadoc, volatile --- .../router/tunnel/pool/TunnelPoolManager.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java index 9698cb65e..a06633873 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java +++ b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java @@ -42,9 +42,8 @@ public class TunnelPoolManager implements TunnelManagerFacade { private final BuildExecutor _executor; private final BuildHandler _handler; private final TunnelPeerSelector _clientPeerSelector; - private boolean _isShutdown; + private volatile boolean _isShutdown; private final int _numHandlerThreads; - private static final long[] RATES = { 60*1000, 10*60*1000l, 60*60*1000l }; private static final int MIN_KBPS_TWO_HANDLERS = 512; private static final int MIN_KBPS_THREE_HANDLERS = 1024; @@ -83,6 +82,7 @@ public class TunnelPoolManager implements TunnelManagerFacade { _numHandlerThreads = ctx.getProperty("router.buildHandlerThreads", numHandlerThreads); // The following are for TestJob + long[] RATES = { 60*1000, 10*60*1000l, 60*60*1000l }; ctx.statManager().createRequiredRateStat("tunnel.testFailedTime", "Time for tunnel test failure (ms)", "Tunnels", RATES); ctx.statManager().createRateStat("tunnel.testExploratoryFailedTime", "How long did the failure of an exploratory tunnel take (max of 60s for full timeout)?", "Tunnels", @@ -100,7 +100,8 @@ public class TunnelPoolManager implements TunnelManagerFacade { } /** - * Pick a random inbound exploratory tunnel + * Pick a random inbound exploratory tunnel. + * Warning - selectInboundExploratoryTunnel(Hash) is preferred. * * @return null if none */ @@ -115,7 +116,8 @@ public class TunnelPoolManager implements TunnelManagerFacade { } /** - * Pick a random inbound tunnel from the given destination's pool + * Pick a random inbound tunnel from the given destination's pool. + * Warning - selectOutboundTunnel(Hash, Hash) is preferred. * * @param destination if null, returns inbound exploratory tunnel * @return null if none @@ -133,7 +135,8 @@ public class TunnelPoolManager implements TunnelManagerFacade { } /** - * Pick a random outbound exploratory tunnel + * Pick a random outbound exploratory tunnel. + * Warning - selectOutboundExploratoryTunnel(Hash) is preferred. * * @return null if none */ @@ -148,7 +151,8 @@ public class TunnelPoolManager implements TunnelManagerFacade { } /** - * Pick a random outbound tunnel from the given destination's pool + * Pick a random outbound tunnel from the given destination's pool. + * Warning - selectOutboundTunnel(Hash, Hash) is preferred. * * @param destination if null, returns outbound exploratory tunnel * @return null if none @@ -364,6 +368,7 @@ public class TunnelPoolManager implements TunnelManagerFacade { public void setInboundSettings(Hash client, TunnelPoolSettings settings) { setSettings(_clientInboundPools, client, settings); } + public void setOutboundSettings(Hash client, TunnelPoolSettings settings) { setSettings(_clientOutboundPools, client, settings); } @@ -544,8 +549,11 @@ public class TunnelPoolManager implements TunnelManagerFacade { out.add(_inboundExploratory); out.add(_outboundExploratory); } + void tunnelFailed() { _executor.repoll(); } + BuildExecutor getExecutor() { return _executor; } + boolean isShutdown() { return _isShutdown; } public int getInboundBuildQueueSize() { return _handler.getInboundBuildQueueSize(); }