java.lang.Object
net.i2p.router.tunnel.pool.ExcluderBase
net.i2p.router.tunnel.pool.ClientPeerSelector.IBGWExcluder
- Enclosing class:
ClientPeerSelector
A Set of Hashes that automatically adds to the Set in the
contains(Object) check.So we don't need to generate the exclude set up front.
Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionIBGWExcluder(Set<Hash> set) Automatically check if peer is connected and add the Hash to the set if not.Method Summary
All MethodsMethods inherited from class ExcluderBase
add, addAll, clear, containsAll, equals, getReasonsSummary, hashCode, isEmpty, iterator, recordExclusion, remove, removeAll, retainAll, size, toArray, toArray, toStringModifier and TypeMethodDescriptionbooleanAdd the hash to the underlying set.booleanaddAll(Collection<? extends Hash> c) Add all of the hashes to the underlying set.voidclear()Remove all hashes from the underlying set.booleancontainsAll(Collection<?> c) Whether the underlying set contains all of the given hashes.booleanWhether the underlying set equals the given object.protected StringFormat exclusion summary grouped by reason (counts only, no peer hashes).inthashCode()The hash code of the underlying set.booleanisEmpty()Whether the underlying set is empty.iterator()An iterator over the underlying set.protected voidrecordExclusion(Hash h, String reason) Record why a peer was excluded, for diagnostic logging.booleanRemove the hash from the underlying set.booleanremoveAll(Collection<?> c) Remove all of the given hashes from the underlying set.booleanretainAll(Collection<?> c) Retain only the given hashes in the underlying set.intsize()The number of hashes in the underlying set.Object[]toArray()The hashes of the underlying set as an array.<Hash> Hash[]toArray(Hash[] a) The hashes of the underlying set in the given array.toString()Description of the excluded set and its size.Methods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface Set
spliterator
Field Details
_allowed
Local cache of peers that passed the IBGW check. These are NOT added to the exclusion sets(they are allowed), but caching them here avoids re-calling allowAsIBGW on every contains() check. The check is delegated to TunnelPeerSelector's endpoint cache (300s TTL, banlist always live) on miss, so entries here are valid for the lifetime of this excluder instance (one selectSingleHop call).
Constructor Details
IBGWExcluder
Method Details
contains
Automatically check if peer is connected and add the Hash to the set if not. Passing peers are cached in_allowedso subsequent contains() calls for the same Hash skip the global cache lookup.- Specified by:
containsin interfaceCollection<Hash>- Specified by:
containsin interfaceSet<Hash>- Specified by:
containsin classExcluderBase- Parameters:
o- the candidate peer hash, as passed bySet.contains(Object)- Returns:
- true if peer should be excluded