java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.FloodfillMonitorJob
- All Implemented Interfaces:
Job
Simple job to monitor the floodfill pool. If we are class N or O, and meet some other criteria, we will automatically become floodfill if there aren't enough. But only change ff status every few hours to minimize ff churn.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanTrue if the floodfill offer was deferred.private final FloodfillNetworkDatabaseFacadeThe network database being monitored.private longWhen the floodfill flag last changed.private final LogLogger for the floodfill monitor.private booleanTrue for the automatic floodfill offering.private static final intFloodfills at which offering stops.private static final longTime between floodfill flag changes.private static final intFloodfills needed before we stop offering.private static final longUptime needed before offering as floodfill.private static final intInterval between the monitor runs.Constructor Summary
ConstructorsConstructorDescriptionFloodfillMonitorJob(RouterContext context, FloodfillNetworkDatabaseFacade facade) Creates a new FloodfillMonitorJob.Method Summary
Modifier and TypeMethodDescriptiongetName()Descriptive name of the task.voidrunJob()Actually perform the task.private booleanshouldBeFloodfill(boolean wasFF) Whether we should offer as a floodfill.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_log
Logger for the floodfill monitor._facade
The network database being monitored._lastChanged
private long _lastChangedWhen the floodfill flag last changed._deferredFlood
private boolean _deferredFloodTrue if the floodfill offer was deferred.REQUEUE_DELAY
private static final int REQUEUE_DELAYInterval between the monitor runs.- See Also:
MIN_UPTIME
private static final long MIN_UPTIMEUptime needed before offering as floodfill.- See Also:
MIN_CHANGE_DELAY
private static final long MIN_CHANGE_DELAYTime between floodfill flag changes.- See Also:
MIN_FF
private static final int MIN_FFFloodfills needed before we stop offering.- See Also:
MAX_FF
autoff
private boolean autoffTrue for the automatic floodfill offering.
Constructor Details
FloodfillMonitorJob
Creates a new FloodfillMonitorJob.- Parameters:
context- the router contextfacade- the floodfill network database facade
Method Details
getName
runJob
public void runJob()Description copied from interface:JobActually perform the task. This call blocks until the Job is complete.shouldBeFloodfill
private boolean shouldBeFloodfill(boolean wasFF) Whether we should offer as a floodfill.- Parameters:
wasFF- true if we were a floodfill- Returns:
- true if we should offer