java.lang.Object
net.i2p.router.peermanager.PeerManagerFacadeImpl
- All Implemented Interfaces:
PeerManagerFacade, Service
Base implementation that has simple algorithms and periodically saves state.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router the manager runs on.private final LogLogger for this class.private PeerManagerThe manager doing the actual work, null until started.private final ProfilePersistenceHelperSaves and restores the peer profiles.private final PeerTestJobJob that tests peers for transport support.private static final booleanSwitch for the peer testing subsystem.Constructor Summary
ConstructorsConstructorDescriptionOpens this facade's log and builds the profile persistence helper and peer tester.Method Summary
All MethodsModifier and TypeMethodDescriptionintcountPeersByCapability(char capability) How many peers advertise the given capability.getPeersByCapability(char capability) Peers advertising the given capability.The peer test job for scheduling priority peer tests.voidremoveCapabilities(Hash peer) Remove all capabilities for the peer from the index.voidrestart()Store the profiles and reload them from disk.voidsetCapabilities(Hash peer, String caps) Record a peer's capability flags.voidshutdown()Shut down the peer manager, storing and clearing the profiles.voidstartup()Start the peer manager and begin testing peers.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Service
renderStatusHTML
Field Details
_log
Logger for this class._manager
The manager doing the actual work, null until started._context
The router the manager runs on._persistenceHelper
Saves and restores the peer profiles._testJob
Job that tests peers for transport support.ENABLE_PEER_TEST
private static final boolean ENABLE_PEER_TESTSwitch for the peer testing subsystem.- See Also:
Constructor Details
PeerManagerFacadeImpl
Opens this facade's log and builds the profile persistence helper and peer tester.- Parameters:
ctx- the router context whose log manager, profile persistence store and peer tester this facade will use
Method Details
startup
shutdown
restart
setCapabilities
Record a peer's capability flags.- Specified by:
setCapabilitiesin interfacePeerManagerFacade- Parameters:
peer- the router hash of the peer whose capabilities are to be setcaps- non-null
removeCapabilities
Remove all capabilities for the peer from the index.- Specified by:
removeCapabilitiesin interfacePeerManagerFacade- Parameters:
peer- the router hash of the peer to clear capabilities from
getPeerTestJob
The peer test job for scheduling priority peer tests.- Specified by:
getPeerTestJobin interfacePeerManagerFacade- Returns:
- the PeerTestJob instance, or null if not available
getPeersByCapability
Peers advertising the given capability.- Specified by:
getPeersByCapabilityin interfacePeerManagerFacade- Parameters:
capability- the address capability letter, matched without regard to case- Returns:
- non-null unmodifiable set
countPeersByCapability
public int countPeersByCapability(char capability) How many peers advertise the given capability.- Specified by:
countPeersByCapabilityin interfacePeerManagerFacade- Parameters:
capability- the address capability letter, matched without regard to case- Returns:
- the number of profiles advertising that capability