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 Details

  • Method Details

    • 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.