From 03df6c2ba0fc74c82c60148ad0b310681e84e472 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 15 Dec 2014 14:38:07 +0000 Subject: [PATCH] less casting --- .../transport/FIFOBandwidthLimiter.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java b/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java index 231dadeec..2f61743a8 100644 --- a/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java +++ b/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java @@ -34,8 +34,8 @@ import net.i2p.util.Log; public class FIFOBandwidthLimiter { private final Log _log; private final I2PAppContext _context; - private final List _pendingInboundRequests; - private final List _pendingOutboundRequests; + private final List _pendingInboundRequests; + private final List _pendingOutboundRequests; /** how many bytes we can consume for inbound transmission immediately */ private final AtomicInteger _availableInbound = new AtomicInteger(); /** how many bytes we can consume for outbound transmission immediately */ @@ -91,8 +91,8 @@ public class FIFOBandwidthLimiter { _context.statManager().createRateStat("bwLimiter.pendingInboundRequests", "How many inbound requests are ahead of the current one (ignoring ones with 0)?", "BandwidthLimiter", new long[] { 5*60*1000l, 60*60*1000l }); _context.statManager().createRateStat("bwLimiter.outboundDelayedTime", "How long it takes to honor an outbound request (ignoring ones with that go instantly)?", "BandwidthLimiter", new long[] { 5*60*1000l, 60*60*1000l }); _context.statManager().createRateStat("bwLimiter.inboundDelayedTime", "How long it takes to honor an inbound request (ignoring ones with that go instantly)?", "BandwidthLimiter", new long[] { 5*60*1000l, 60*60*1000l }); - _pendingInboundRequests = new ArrayList(16); - _pendingOutboundRequests = new ArrayList(16); + _pendingInboundRequests = new ArrayList(16); + _pendingOutboundRequests = new ArrayList(16); _lastTotalSent = _totalAllocatedOutboundBytes.get(); _lastTotalReceived = _totalAllocatedInboundBytes.get(); _lastStatsUpdated = now(); @@ -450,7 +450,7 @@ public class FIFOBandwidthLimiter { private long locked_getLongestInboundWait() { long start = -1; for (int i = 0; i < _pendingInboundRequests.size(); i++) { - SimpleRequest req = (SimpleRequest)_pendingInboundRequests.get(i); + Request req = _pendingInboundRequests.get(i); if ( (start < 0) || (start > req.getRequestTime()) ) start = req.getRequestTime(); } @@ -464,7 +464,7 @@ public class FIFOBandwidthLimiter { private long locked_getLongestOutboundWait() { long start = -1; for (int i = 0; i < _pendingOutboundRequests.size(); i++) { - SimpleRequest req = (SimpleRequest)_pendingOutboundRequests.get(i); + Request req = _pendingOutboundRequests.get(i); if (req == null) continue; if ( (start < 0) || (start > req.getRequestTime()) ) start = req.getRequestTime(); @@ -481,7 +481,7 @@ public class FIFOBandwidthLimiter { */ private final void locked_satisfyInboundUnlimited(List satisfied) { while (!_pendingInboundRequests.isEmpty()) { - SimpleRequest req = (SimpleRequest)_pendingInboundRequests.remove(0); + SimpleRequest req = _pendingInboundRequests.remove(0); int allocated = req.getPendingRequested(); _totalAllocatedInboundBytes.addAndGet(allocated); req.allocateBytes(allocated); @@ -506,7 +506,7 @@ public class FIFOBandwidthLimiter { private final void locked_satisfyInboundAvailable(List satisfied) { for (int i = 0; i < _pendingInboundRequests.size(); i++) { if (_availableInbound.get() <= 0) break; - SimpleRequest req = (SimpleRequest)_pendingInboundRequests.get(i); + SimpleRequest req = _pendingInboundRequests.get(i); long waited = now() - req.getRequestTime(); if (req.getAborted()) { // connection decided they dont want the data anymore @@ -598,7 +598,7 @@ public class FIFOBandwidthLimiter { */ private final void locked_satisfyOutboundUnlimited(List satisfied) { while (!_pendingOutboundRequests.isEmpty()) { - SimpleRequest req = (SimpleRequest)_pendingOutboundRequests.remove(0); + SimpleRequest req = _pendingOutboundRequests.remove(0); int allocated = req.getPendingRequested(); _totalAllocatedOutboundBytes.addAndGet(allocated); req.allocateBytes(allocated); @@ -624,7 +624,7 @@ public class FIFOBandwidthLimiter { private final void locked_satisfyOutboundAvailable(List satisfied) { for (int i = 0; i < _pendingOutboundRequests.size(); i++) { if (_availableOutbound.get() <= 0) break; - SimpleRequest req = (SimpleRequest)_pendingOutboundRequests.get(i); + SimpleRequest req = _pendingOutboundRequests.get(i); long waited = now() - req.getRequestTime(); if (req.getAborted()) { // connection decided they dont want the data anymore