Changeset e0fc642


Ignore:
Timestamp:
Sep 10, 2012 5:27:18 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
e8a8f3c
Parents:
835ed6d
Message:

reduce _jobLock contention

Location:
router/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/JobQueue.java

    r835ed6d re0fc642  
    5656   
    5757    private final Object _jobLock;
     58    private volatile long _nextPumperRun;
    5859   
    5960    /** how many when we go parallel */
     
    188189                        _timedJobs.add(job);
    189190                        // only notify for _timedJobs, as _readyJobs does not use that lock
    190                         _jobLock.notifyAll();
     191                        // only notify if sooner, to reduce contention
     192                        if (job.getTiming().getStartAfter() < _nextPumperRun)
     193                            _jobLock.notifyAll();
    191194                    }
    192195                }
     
    226229    }
    227230   
     231    /**
     232     *  @deprecated contention - see JobTiming.setStartAfter() comments
     233     */
    228234    public void timingUpdated() {
    229235        synchronized (_jobLock) {
     
    519525                                //if (_log.shouldLog(Log.DEBUG))
    520526                                //    _log.debug("Waiting " + timeToWait + " before rechecking the timed queue");
     527                                _nextPumperRun = _context.clock().now() + timeToWait;
    521528                                _jobLock.wait(timeToWait);
    522529                        } // synchronize (_jobLock)
  • router/java/src/net/i2p/router/JobTiming.java

    r835ed6d re0fc642  
    4444        // ...
    4545        // who cares?   this helps in the case where it is on the queue
    46         _context.jobQueue().timingUpdated();
     46        //_context.jobQueue().timingUpdated();
    4747    }
    4848   
Note: See TracChangeset for help on using the changeset viewer.