java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.ExpireLeasesJob
- All Implemented Interfaces:
Job
Periodically searches through all leases to find expired ones, failing those keys and firing up a new search for each (in case we want it later, might as well preemptively fetch it). Also refreshes leasesets that are about to expire to ensure continuity of service.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classOldest first.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final KademliaNetworkDatabaseFacadeThe facade whose leases expire.private final LogLogger for this class.private static final intMost leases a normal router checks in one pass.private static final intMost leases a floodfill checks in one pass.private static final longRefresh leasesets with less than this much time remaining before expiry.private static final longPause before the next pass - 30 seconds.private static final longAfter this long past expiry, a leaseset is considered stale and purged immediately bypurgeStaleLeasesets()in a client database.Constructor Summary
ConstructorsConstructorDescriptionExpireLeasesJob(RouterContext ctx, KademliaNetworkDatabaseFacade facade) Opens the job log and remembers the facade whose leasesets are expired.Method Summary
Modifier and TypeMethodDescriptiongetName()Name of this job.Tunnel nickname for the given destination, if it has inbound tunnels.private voidAggressively purge leasesets that have been expired for longer than the stale threshold.private voidRefresh leasesets that are about to expire to ensure continuity of service.voidrunJob()Expire outdated lease sets and refresh those about to expire.Run through the entire data store, finding all expired leaseSets (ones that don't have any leases that haven't yet passed, even with the CLOCK_FUDGE_FACTOR).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 this class._facade
The facade whose leases expire.RERUN_DELAY_MS
private static final long RERUN_DELAY_MSPause before the next pass - 30 seconds.- See Also:
LIMIT_LEASES_FF
private static final int LIMIT_LEASES_FFMost leases a floodfill checks in one pass.- See Also:
LIMIT_LEASES_CLIENT
private static final int LIMIT_LEASES_CLIENTMost leases a normal router checks in one pass.REFRESH_THRESHOLD_MS
private static final long REFRESH_THRESHOLD_MSRefresh leasesets with less than this much time remaining before expiry.- See Also:
STALE_EXPIRED_MS
private static final long STALE_EXPIRED_MSAfter this long past expiry, a leaseset is considered stale and purged immediately bypurgeStaleLeasesets()in a client database.- See Also:
Constructor Details
ExpireLeasesJob
Opens the job log and remembers the facade whose leasesets are expired.- Parameters:
ctx- the router context supplying the clock, log manager and job queuefacade- the network database whose leasesets this job expires and refreshes
Method Details
getName
runJob
public void runJob()Expire outdated lease sets and refresh those about to expire.purgeStaleLeasesets
private void purgeStaleLeasesets()Aggressively purge leasesets that have been expired for longer than the stale threshold. This ensures expired leasesets don't linger in the netdb for extended periods.refreshAboutToExpire
private void refreshAboutToExpire()Refresh leasesets that are about to expire to ensure continuity of service. This preemptively fetches new leasesets before the old ones expire, avoiding any gap in service.selectKeysToExpire
getTunnelName
Tunnel nickname for the given destination, if it has inbound tunnels.- Parameters:
d- the destination to name the tunnel pool for, or null for the empty name- Returns:
- the tunnel name