Changeset 10f3337


Ignore:
Timestamp:
Aug 19, 2011 3:30:31 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
26c744c
Parents:
de09443
Message:

cleanups

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ShitlistRenderer.java

    rde09443 r10f3337  
    2525 */
    2626public class ShitlistRenderer {
    27     private RouterContext _context;
     27    private final RouterContext _context;
    2828
    2929    public ShitlistRenderer(RouterContext context) {
     
    3131    }
    3232   
    33     private static class HashComparator implements Comparator {
    34          public int compare(Object l, Object r) {
    35              return ((Hash)l).toBase64().compareTo(((Hash)r).toBase64());
     33    private static class HashComparator implements Comparator<Hash> {
     34         public int compare(Hash l, Hash r) {
     35             return l.toBase64().compareTo(r.toBase64());
    3636        }
    3737    }
     
    5555            Hash key = e.getKey();
    5656            Shitlist.Entry entry = e.getValue();
     57            long expires = entry.expireOn-_context.clock().now();
     58            if (expires <= 0)
     59                continue;
    5760            buf.append("<li>").append(_context.commSystem().renderPeerHTML(key));
    5861            buf.append(' ');
    59             long expires = entry.expireOn-_context.clock().now();
    6062            String expireString = DataHelper.formatDuration2(expires);
    6163            if (expires < 5l*24*60*60*1000)
  • router/java/src/net/i2p/router/Shitlist.java

    rde09443 r10f3337  
    1212import java.io.Writer;
    1313import java.util.ArrayList;
    14 import java.util.HashMap;
     14import java.util.Collections;
    1515import java.util.Iterator;
    1616import java.util.List;
     
    5656        _context = context;
    5757        _log = context.logManager().getLog(Shitlist.class);
    58         _entries = new ConcurrentHashMap(8);
     58        _entries = new ConcurrentHashMap(16);
    5959        _context.jobQueue().addJob(new Cleanup(_context));
    6060    }
     
    9797    }
    9898   
    99     /** for ShitlistRenderer in router console */
     99    /**
     100     *  For ShitlistRenderer in router console.
     101     *  Note - may contain expired entries.
     102     */
    100103    public Map<Hash, Entry> getEntries() {
    101         return new HashMap<Hash, Entry>(_entries);
     104        return Collections.unmodifiableMap(_entries);
    102105    }
    103106   
Note: See TracChangeset for help on using the changeset viewer.