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
Method Summary |
boolean |
trim(KBucket<NID> kbucket,
NID toAdd)
Called from add() just before adding the entry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KBTrimmer
public KBTrimmer(I2PAppContext ctx,
int max)
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 interface KBucketTrimmer<NID>
- Parameters:
kbucket
- the kbucket that is now too big
- Returns:
- true to actually add the entry.