Package net.i2p.router.tunnel.pool
Class BuildExecutor
java.lang.Object
net.i2p.router.tunnel.pool.BuildExecutor
- All Implemented Interfaces:
Runnable
class BuildExecutor extends Object implements Runnable
Single threaded controller of the tunnel creation process, spanning all tunnel pools.
Essentially, this loops across the pools, sees which want to build tunnels, and fires
off the necessary activities if the load allows. If nothing wants to build any tunnels,
it waits for a short period before looping again (or until it is told that something
changed, such as a tunnel failed, new client started up, or tunnel creation was aborted).
Note that 10 minute tunnel expiration is hardcoded in here.
As of 0.8.11, inbound request handling is done in a separate thread.
-
Constructor Summary
Constructors Constructor Description BuildExecutor(RouterContext ctx, TunnelPoolManager mgr)
-
Method Summary
Modifier and Type Method Description void
buildComplete(PooledTunnelCreatorConfig cfg)
This wakes up the executor, so call this after TunnelPool.addTunnel() so we don't build too many.void
buildSuccessful(PooledTunnelCreatorConfig cfg)
(package private) void
buildTunnel(PooledTunnelCreatorConfig cfg)
boolean
fullStats()
boolean
isRunning()
(package private) PooledTunnelCreatorConfig
removeFromBuilding(long id)
This returns the PTCC up to a minute after it 'expired', thus allowing us to still use a tunnel if it was accepted, and to update peer stats.void
repoll()
void
restart()
void
run()
void
shutdown()
Cannot be restarted.boolean
wasRecentlyBuilding(long replyId)
-
Constructor Details
-
Method Details
-
fullStats
public boolean fullStats() -
restart
public void restart()- Since:
- 0.9
-
shutdown
public void shutdown()Cannot be restarted.- Since:
- 0.9
-
run
public void run() -
isRunning
public boolean isRunning() -
buildTunnel
-
buildComplete
This wakes up the executor, so call this after TunnelPool.addTunnel() so we don't build too many. -
wasRecentlyBuilding
public boolean wasRecentlyBuilding(long replyId) -
buildSuccessful
-
repoll
public void repoll() -
removeFromBuilding
This returns the PTCC up to a minute after it 'expired', thus allowing us to still use a tunnel if it was accepted, and to update peer stats. This means that manager.buildComplete() could be called more than once, and a build can be failed or successful after it was timed out, which will affect the stats and profiles. But that's ok. A peer that rejects slowly gets penalized twice, for example.- Returns:
- ptcc or null
- Since:
- 0.7.12
-