Package org.klomp.snark.dht
Class KBTrimmer
- java.lang.Object
-
- org.klomp.snark.dht.KBTrimmer
-
- All Implemented Interfaces:
KBucketTrimmer<NID>
class KBTrimmer extends Object implements KBucketTrimmer<NID>
Removes an element older than 15 minutes, but only if the bucket hasn't changed in 5 minutes.- Since:
- 0.9.2
-
-
Constructor Summary
Constructors Constructor Description KBTrimmer(I2PAppContext ctx, int max)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
trim(KBucket<NID> kbucket, NID toAdd)
Called from add() just before adding the entry.
-
-
-
Constructor Detail
-
KBTrimmer
public KBTrimmer(I2PAppContext ctx, int max)
-
-
Method Detail
-
trim
public boolean trim(KBucket<NID> kbucket, NID toAdd)
Description copied from interface:KBucketTrimmer
Called from add() just before adding the entry. You may call getEntries() and/or remove() from here. Do NOT call add(). To always discard a newer entry, always return false.- Specified by:
trim
in interfaceKBucketTrimmer<NID>
- Parameters:
kbucket
- the kbucket that is now too big- Returns:
- true to actually add the entry.
-
-