This commit is contained in:
zzz
2011-03-22 02:08:03 +00:00
parent 1b2519cfb8
commit c7a574fe01
7 changed files with 27 additions and 42 deletions

View File

@ -13,8 +13,8 @@ import net.i2p.util.Log;
*
*/
public class DBHistory {
private Log _log;
private RouterContext _context;
private final Log _log;
private final RouterContext _context;
private long _successfulLookups;
private long _failedLookups;
private RateStat _failedLookupRate;
@ -38,19 +38,7 @@ public class DBHistory {
_context = context;
_log = context.logManager().getLog(DBHistory.class);
_statGroup = statGroup;
_successfulLookups = 0;
_failedLookups = 0;
_failedLookupRate = null;
_invalidReplyRate = null;
_lookupReplyNew = 0;
_lookupReplyOld = 0;
_lookupReplyDuplicate = 0;
_lookupReplyInvalid = 0;
_lookupsReceived = 0;
_avgDelayBetweenLookupsReceived = 0;
_lastLookupReceived = -1;
_unpromptedDbStoreNew = 0;
_unpromptedDbStoreOld = 0;
createRates(statGroup);
}

View File

@ -43,11 +43,11 @@ import net.i2p.util.ConcurrentHashSet;
*
*/
class PeerManager {
private Log _log;
private RouterContext _context;
private ProfileOrganizer _organizer;
private ProfilePersistenceHelper _persistenceHelper;
private Set<Hash> _peersByCapability[];
private final Log _log;
private final RouterContext _context;
private final ProfileOrganizer _organizer;
private final ProfilePersistenceHelper _persistenceHelper;
private final Set<Hash> _peersByCapability[];
private final Map<Hash, String> _capabilitiesByPeer;
public PeerManager(RouterContext context) {

View File

@ -24,11 +24,11 @@ import net.i2p.util.Log;
*
*/
public class PeerManagerFacadeImpl implements PeerManagerFacade {
private Log _log;
private final Log _log;
private PeerManager _manager;
private RouterContext _context;
private ProfilePersistenceHelper _persistenceHelper;
private PeerTestJob _testJob;
private final RouterContext _context;
private final ProfilePersistenceHelper _persistenceHelper;
private final PeerTestJob _testJob;
public PeerManagerFacadeImpl(RouterContext ctx) {
_context = ctx;

View File

@ -27,7 +27,7 @@ import net.i2p.util.Log;
*
*/
public class PeerTestJob extends JobImpl {
private Log _log;
private final Log _log;
private PeerManager _manager;
private boolean _keepTesting;
private static final long DEFAULT_PEER_TEST_DELAY = 5*60*1000;

View File

@ -22,8 +22,8 @@ import net.i2p.router.RouterContext;
import net.i2p.util.Log;
public class ProfileManagerImpl implements ProfileManager {
private Log _log;
private RouterContext _context;
private final Log _log;
private final RouterContext _context;
public ProfileManagerImpl(RouterContext context) {
_context = context;

View File

@ -40,23 +40,23 @@ import net.i2p.util.Log;
* should be used to add new profiles (placing them into the appropriate groupings).
*/
public class ProfileOrganizer {
private Log _log;
private RouterContext _context;
private final Log _log;
private final RouterContext _context;
/** H(routerIdentity) to PeerProfile for all peers that are fast and high capacity*/
private Map<Hash, PeerProfile> _fastPeers;
private final Map<Hash, PeerProfile> _fastPeers;
/** H(routerIdentity) to PeerProfile for all peers that have high capacities */
private Map<Hash, PeerProfile> _highCapacityPeers;
private final Map<Hash, PeerProfile> _highCapacityPeers;
/** H(routerIdentity) to PeerProfile for all peers that well integrated into the network and not failing horribly */
private Map<Hash, PeerProfile> _wellIntegratedPeers;
private final Map<Hash, PeerProfile> _wellIntegratedPeers;
/** H(routerIdentity) to PeerProfile for all peers that are not failing horribly */
private Map<Hash, PeerProfile> _notFailingPeers;
private final Map<Hash, PeerProfile> _notFailingPeers;
/** H(routerIdnetity), containing elements in _notFailingPeers */
private List<Hash> _notFailingPeersList;
private final List<Hash> _notFailingPeersList;
/** H(routerIdentity) to PeerProfile for all peers that ARE failing horribly (but that we haven't dropped reference to yet) */
private Map<Hash, PeerProfile> _failingPeers;
private final Map<Hash, PeerProfile> _failingPeers;
/** who are we? */
private Hash _us;
private ProfilePersistenceHelper _persistenceHelper;
private final ProfilePersistenceHelper _persistenceHelper;
/** PeerProfile objects for all peers profiled, orderd by the ones with the highest capacity first */
private Set<PeerProfile> _strictCapacityOrder;
@ -68,7 +68,7 @@ public class ProfileOrganizer {
/** integration value, seperating well integrated from not well integrated */
private double _thresholdIntegrationValue;
private InverseCapacityComparator _comp;
private final InverseCapacityComparator _comp;
/**
* Defines the minimum number of 'fast' peers that the organizer should select. See
@ -105,9 +105,6 @@ public class ProfileOrganizer {
_notFailingPeersList = new ArrayList(256);
_failingPeers = new HashMap(16);
_strictCapacityOrder = new TreeSet(_comp);
_thresholdSpeedValue = 0.0d;
_thresholdCapacityValue = 0.0d;
_thresholdIntegrationValue = 0.0d;
_persistenceHelper = new ProfilePersistenceHelper(_context);
_context.statManager().createRateStat("peer.profileSortTime", "How long the reorg takes sorting peers", "Peers", new long[] { 10*60*1000 });

View File

@ -14,8 +14,8 @@ import net.i2p.util.Log;
*
*/
public class TunnelHistory {
private RouterContext _context;
private Log _log;
private final RouterContext _context;
private final Log _log;
private volatile long _lifetimeAgreedTo;
private volatile long _lifetimeRejected;
private volatile long _lastAgreedTo;
@ -27,7 +27,7 @@ public class TunnelHistory {
private volatile long _lastFailed;
private RateStat _rejectRate;
private RateStat _failRate;
private String _statGroup;
private final String _statGroup;
/** probabalistic tunnel rejection due to a flood of requests - essentially unused */
public static final int TUNNEL_REJECT_PROBABALISTIC_REJECT = 10;