forked from I2P_Developers/i2p.i2p
javadoc and more clearing at shutdown
This commit is contained in:
@ -52,6 +52,11 @@ class PeerManager {
|
||||
private static final long REORGANIZE_TIME_MEDIUM = 123*1000;
|
||||
private static final long REORGANIZE_TIME_LONG = 551*1000;
|
||||
|
||||
/**
|
||||
* Warning - this loads all the profiles in the constructor.
|
||||
* This may take a long time - 30 seconds or more.
|
||||
* Instantiate this in a Job or Thread.
|
||||
*/
|
||||
public PeerManager(RouterContext context) {
|
||||
_context = context;
|
||||
_log = context.logManager().getLog(PeerManager.class);
|
||||
@ -102,6 +107,9 @@ class PeerManager {
|
||||
/** @since 0.8.8 */
|
||||
void clearProfiles() {
|
||||
_organizer.clearProfiles();
|
||||
_capabilitiesByPeer.clear();
|
||||
for (int i = 0; i < _peersByCapability.length; i++)
|
||||
_peersByCapability[i].clear();
|
||||
}
|
||||
|
||||
Set selectPeers() {
|
||||
@ -116,8 +124,10 @@ class PeerManager {
|
||||
_persistenceHelper.writeProfile(prof);
|
||||
}
|
||||
|
||||
/**
|
||||
* This may take a long time - 30 seconds or more
|
||||
*/
|
||||
void loadProfiles() {
|
||||
// TODO do this in a Thread or a Job to not slow down the constructor
|
||||
Set<PeerProfile> profiles = _persistenceHelper.readProfiles();
|
||||
for (Iterator<PeerProfile> iter = profiles.iterator(); iter.hasNext();) {
|
||||
PeerProfile prof = iter.next();
|
||||
|
Reference in New Issue
Block a user