Changeset 3882e49


Ignore:
Timestamp:
Sep 6, 2011 1:27:07 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
640782a
Parents:
b64cb14
Message:
  • JobQueue?: Change queue from a List to a Set for efficiency
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    rb64cb14 r3882e49  
     12011-09-06 zzz
     2  * Crypto: Rework use of SHA256 for efficiency and
     3    to avoid clogging the Hash cache with one-time hashes,
     4    and avoiding the global cache lock.
     5    This also greatly increases Hash cache hit rates.
     6    Also use SimpleByteCache for temporary byte buffers.
     7  * I2PTunnel: Save keys to privkey file when enabling
     8    persistent key after tunnel creation (ticket #480)
     9  * JobQueue: Change queue from a List to a Set for efficiency
     10  * PrivateKeyFile: Add more constructors
     11  * SDSCache: Use weak refs; increase size for pub keys
     12
    1132011-09-04 zzz
    214  * NetDB:
  • router/java/src/net/i2p/router/JobQueue.java

    rb64cb14 r3882e49  
    1414import java.util.Collection;
    1515import java.util.Collections;
     16import java.util.HashSet;
    1617import java.util.Iterator;
    1718import java.util.List;
     
    1920import java.util.SortedMap;
    2021import java.util.TreeMap;
     22import java.util.Set;
    2123import java.util.concurrent.ConcurrentHashMap;
    2224import java.util.concurrent.BlockingQueue;
     
    4547    private final BlockingQueue<Job> _readyJobs;
    4648    /** list of jobs that are scheduled for running in the future */
    47     private final List<Job> _timedJobs;
     49    private final Set<Job> _timedJobs;
    4850    /** job name to JobStat for that job */
    4951    private final Map<String, JobStats> _jobStats;
     
    136138        _alive = true;
    137139        _readyJobs = new LinkedBlockingQueue();
    138         _timedJobs = new ArrayList(64);
     140        _timedJobs = new HashSet(64);
    139141        _jobLock = new Object();
    140142        _queueRunners = new ConcurrentHashMap(RUNNERS);
     
    455457                    try {
    456458                        synchronized (_jobLock) {
    457                             for (int i = 0; i < _timedJobs.size(); i++) {
    458                                 Job j = _timedJobs.get(i);
     459                            for (Iterator<Job> iter = _timedJobs.iterator(); iter.hasNext(); ) {
     460                                Job j = iter.next();
    459461                                // find jobs due to start before now
    460462                                long timeLeft = j.getTiming().getStartAfter() - now;
     
    465467                                    if (toAdd == null) toAdd = new ArrayList(4);
    466468                                    toAdd.add(j);
    467                                     _timedJobs.remove(i);
    468                                     i--; // so the index stays consistent
     469                                    iter.remove();
    469470                                } else {
    470471                                    if ( (timeToWait <= 0) || (timeLeft < timeToWait) )
     
    520521    private void updateJobTimings(long delta) {
    521522        synchronized (_jobLock) {
    522             for (int i = 0; i < _timedJobs.size(); i++) {
    523                 Job j = _timedJobs.get(i);
     523            for (Job j : _timedJobs) {
    524524                j.getTiming().offsetChanged(delta);
    525525            }
  • router/java/src/net/i2p/router/RouterVersion.java

    rb64cb14 r3882e49  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 11;
     21    public final static long BUILD = 12;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.