Changeset 653abbcc


Ignore:
Timestamp:
Jan 19, 2011 5:18:39 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
da2f4cb
Parents:
8da1e90
Message:

transport cleanups: final, init, pkg private

Location:
router/java/src/net/i2p/router/transport
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java

    r8da1e90 r653abbcc  
    3737
    3838public class CommSystemFacadeImpl extends CommSystemFacade {
    39     private Log _log;
    40     private RouterContext _context;
     39    private final Log _log;
     40    private final RouterContext _context;
    4141    private TransportManager _manager;
    4242    private GeoIP _geoIP;
     
    4545        _context = context;
    4646        _log = _context.logManager().getLog(CommSystemFacadeImpl.class);
    47         _manager = null;
    4847        _context.statManager().createRateStat("transport.getBidsJobTime", "How long does it take?", "Transport", new long[] { 10*60*1000l });
    4948        startGeoIP();
  • router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java

    r8da1e90 r653abbcc  
    3232 */
    3333public class FIFOBandwidthLimiter {
    34     private Log _log;
    35     private I2PAppContext _context;
     34    private final Log _log;
     35    private final I2PAppContext _context;
    3636    private final List<Request> _pendingInboundRequests;
    3737    private final List<Request> _pendingOutboundRequests;
    3838    /** how many bytes we can consume for inbound transmission immediately */
    39     private AtomicInteger _availableInbound = new AtomicInteger();
     39    private final AtomicInteger _availableInbound = new AtomicInteger();
    4040    /** how many bytes we can consume for outbound transmission immediately */
    41     private AtomicInteger _availableOutbound = new AtomicInteger();
     41    private final AtomicInteger _availableOutbound = new AtomicInteger();
    4242    /** how many bytes we can queue up for bursting */
    43     private AtomicInteger _unavailableInboundBurst = new AtomicInteger();
     43    private final AtomicInteger _unavailableInboundBurst = new AtomicInteger();
    4444    /** how many bytes we can queue up for bursting */
    45     private AtomicInteger _unavailableOutboundBurst = new AtomicInteger();
     45    private final AtomicInteger _unavailableOutboundBurst = new AtomicInteger();
    4646    /** how large _unavailableInbound can get */
    4747    private int _maxInboundBurst;
     
    5757    private boolean _inboundUnlimited;
    5858    /** lifetime counter of bytes received */
    59     private AtomicLong _totalAllocatedInboundBytes = new AtomicLong();
     59    private final AtomicLong _totalAllocatedInboundBytes = new AtomicLong();
    6060    /** lifetime counter of bytes sent */
    61     private AtomicLong _totalAllocatedOutboundBytes = new AtomicLong();
     61    private final AtomicLong _totalAllocatedOutboundBytes = new AtomicLong();
    6262    /** lifetime counter of tokens available for use but exceeded our maxInboundBurst size */
    63     private AtomicLong _totalWastedInboundBytes = new AtomicLong();
     63    private final AtomicLong _totalWastedInboundBytes = new AtomicLong();
    6464    /** lifetime counter of tokens available for use but exceeded our maxOutboundBurst size */
    65     private AtomicLong _totalWastedOutboundBytes = new AtomicLong();
    66     private FIFOBandwidthRefiller _refiller;
     65    private final AtomicLong _totalWastedOutboundBytes = new AtomicLong();
     66    private final FIFOBandwidthRefiller _refiller;
    6767   
    6868    private long _lastTotalSent;
     
    7373    private float _sendBps15s;
    7474    private float _recvBps15s;
    75    
    76     private static int __id = 0;
    7775   
    7876    public /* static */ long now() {
     
    9997        _lastTotalSent = _totalAllocatedOutboundBytes.get();
    10098        _lastTotalReceived = _totalAllocatedInboundBytes.get();
    101         _sendBps = 0;
    102         _recvBps = 0;
    10399        _lastStatsUpdated = now();
    104100        _refiller = new FIFOBandwidthRefiller(_context, this);
    105         I2PThread t = new I2PThread(_refiller);
    106         t.setName("BWRefiller" + (++__id));
    107         t.setDaemon(true);
     101        I2PThread t = new I2PThread(_refiller, "BWRefiller", true);
    108102        t.setPriority(I2PThread.NORM_PRIORITY-1);
    109103        t.start();
     
    754748        private boolean _aborted;
    755749        private boolean _waited;
    756         List<Request> satisfiedBuffer;
     750        final List<Request> satisfiedBuffer;
    757751        private CompleteListener _lsnr;
    758752        private Object _attachment;
  • router/java/src/net/i2p/router/transport/FIFOBandwidthRefiller.java

    r8da1e90 r653abbcc  
    88
    99public class FIFOBandwidthRefiller implements Runnable {
    10     private Log _log;
    11     private I2PAppContext _context;
    12     private FIFOBandwidthLimiter _limiter;
     10    private final Log _log;
     11    private final I2PAppContext _context;
     12    private final FIFOBandwidthLimiter _limiter;
    1313    /** how many KBps do we want to allow? */
    1414    private int _inboundKBytesPerSecond;
  • router/java/src/net/i2p/router/transport/GeoIP.java

    r8da1e90 r653abbcc  
    3636 * @author zzz
    3737 */
    38 public class GeoIP {
     38class GeoIP {
    3939    private Log _log;
    4040    private RouterContext _context;
  • router/java/src/net/i2p/router/transport/GetBidsJob.java

    r8da1e90 r653abbcc  
    2222 *
    2323 */
    24 public class GetBidsJob extends JobImpl {
    25     private Log _log;
    26     private CommSystemFacadeImpl _facade;
    27     private OutNetMessage _msg;
     24class GetBidsJob extends JobImpl {
     25    private final Log _log;
     26    private final CommSystemFacadeImpl _facade;
     27    private final OutNetMessage _msg;
    2828   
    2929    public GetBidsJob(RouterContext ctx, CommSystemFacadeImpl facade, OutNetMessage msg) {
  • router/java/src/net/i2p/router/transport/TransportManager.java

    r8da1e90 r653abbcc  
    3838
    3939public class TransportManager implements TransportEventListener {
    40     private Log _log;
     40    private final Log _log;
    4141    /**
    4242     * Converted from List to prevent concurrent modification exceptions.
    4343     * If we want more than one transport with the same style we will have to change this.
    4444     */
    45     private Map<String, Transport> _transports;
    46     private RouterContext _context;
    47     private UPnPManager _upnpManager;
     45    private final Map<String, Transport> _transports;
     46    private final RouterContext _context;
     47    private final UPnPManager _upnpManager;
    4848
    4949    /** default true */
     
    6464        _context.statManager().createRateStat("transport.bidFailAllTransports", "Could not attempt to bid on message, as all of the transports had failed", "Transport", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    6565        _transports = new ConcurrentHashMap(2);
    66         if (Boolean.valueOf(_context.getProperty(PROP_ENABLE_UPNP, "true")).booleanValue())
     66        if (_context.getBooleanPropertyDefaultTrue(PROP_ENABLE_UPNP))
    6767            _upnpManager = new UPnPManager(context, this);
     68        else
     69            _upnpManager = null;
    6870    }
    6971   
  • router/java/src/net/i2p/router/transport/UPnP.java

    r8da1e90 r653abbcc  
    5353 * TODO: Implement EventListener and react on ip-change
    5454 */
    55 public class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
     55class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
    5656        private Log _log;
    5757        private I2PAppContext _context;
  • router/java/src/net/i2p/router/transport/UPnPManager.java

    r8da1e90 r653abbcc  
    2525 * @author zzz
    2626 */
    27 public class UPnPManager {
     27class UPnPManager {
    2828    private Log _log;
    2929    private RouterContext _context;
Note: See TracChangeset for help on using the changeset viewer.