Changeset 3fc312a6
- Timestamp:
- Dec 5, 2011 12:59:58 AM (9 years ago)
- Branches:
- master
- Children:
- 51899e9
- Parents:
- e9d0d79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/transport/FIFOBandwidthRefiller.java
re9d0d79 r3fc312a6 4 4 import java.util.List; 5 5 import java.util.concurrent.atomic.AtomicInteger; 6 import java.util.concurrent.locks.ReentrantReadWriteLock; 6 7 7 8 import net.i2p.I2PAppContext; … … 304 305 /** the actual length of the period (nominally REPLENISH_FREQUENCY) */ 305 306 private final long[] _times = new long[PERIODS]; 307 private final ReentrantReadWriteLock _updateLock = new ReentrantReadWriteLock(false); 306 308 307 309 /** … … 321 323 * @since 0.8.12 322 324 */ 323 synchronized int getCurrentParticipatingBandwidth() { 325 int getCurrentParticipatingBandwidth() { 326 _updateLock.readLock().lock(); 327 try { 328 return locked_getCurrentParticipatingBandwidth(); 329 } finally { 330 _updateLock.readLock().unlock(); 331 } 332 } 333 334 private int locked_getCurrentParticipatingBandwidth() { 324 335 int current = _currentParticipating.get(); 325 336 long totalTime = (_limiter.now() - _lastPartUpdateTime) + _lastTotalTime; … … 338 349 * @since 0.8.12 339 350 */ 340 private synchronized void updateParticipating(long now) { 351 private void updateParticipating(long now) { 352 _updateLock.writeLock().lock(); 353 try { 354 locked_updateParticipating(now); 355 } finally { 356 _updateLock.writeLock().unlock(); 357 } 358 } 359 360 private void locked_updateParticipating(long now) { 341 361 long elapsed = now - _lastPartUpdateTime; 342 362 if (elapsed <= 0) {
Note: See TracChangeset
for help on using the changeset viewer.