Changeset 948de54


Ignore:
Timestamp:
Aug 28, 2011 2:31:39 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5e507c0
Parents:
100f6da
Message:
  • Stats: Restore pre-0.8.8 API to not create a new Rate if it does not

exist in RateStat?.getRate()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/stat/RateStat.java

    r100f6da r948de54  
    2929        _description = description;
    3030        _groupName = group;
    31         _rates = new ConcurrentHashMap<Long, Rate>();
     31        _rates = new ConcurrentHashMap<Long, Rate>(4);
    3232        for (int i = 0; i < periods.length; i++) {
    3333            Rate rate = new Rate(periods[i]);
     
    8686    /**
    8787     * Returns rate with requested period if it exists,
    88      * otherwise creates new rate with requested period, adds it to  list of rates and returns it.
     88     * otherwise null
    8989     * @param period ms
    9090     * @return the Rate
    9191     */
    9292    public Rate getRate(long period) {
    93         if (_rates.containsKey(period)){
    94                 return _rates.get(period);
    95         } else {
    96                 Rate rate = new Rate(period);
    97                 rate.setRateStat(this);
    98                 _rates.put(period, rate);
    99                 return rate;
    100         }
     93        //if (_rates.containsKey(period)){
     94                return _rates.get(Long.valueOf(period));
     95        //} else {
     96        //      Rate rate = new Rate(period);
     97        //      rate.setRateStat(this);
     98        //      _rates.put(period, rate);
     99        //      return rate;
     100        //}
    101101    }
    102102   
Note: See TracChangeset for help on using the changeset viewer.