Changeset 90b8aa7


Ignore:
Timestamp:
Jul 8, 2011 6:31:50 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b41c5834
Parents:
56650eb
Message:

concurrent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java

    r56650eb r90b8aa7  
    1010 */
    1111
    12 import java.util.HashMap;
    1312import java.util.Map;
     13import java.util.concurrent.ConcurrentHashMap;
    1414
    1515import net.i2p.I2PAppContext;
     
    3939    public RequestLeaseSetMessageHandler(I2PAppContext context) {
    4040        super(context, RequestLeaseSetMessage.MESSAGE_TYPE);
    41         _existingLeaseSets = new HashMap(32);
     41        // not clear why there would ever be more than one
     42        _existingLeaseSets = new ConcurrentHashMap(4);
    4243    }
    4344   
     
    5960
    6061        // reuse the old keys for the client
    61         LeaseInfo li = null;
    62         synchronized (_existingLeaseSets) {
    63             if (_existingLeaseSets.containsKey(session.getMyDestination()))
    64                 li = (LeaseInfo) _existingLeaseSets.get(session.getMyDestination());
    65         }
     62        LeaseInfo li = (LeaseInfo) _existingLeaseSets.get(session.getMyDestination());
    6663        if (li == null) {
    6764            li = new LeaseInfo(session.getMyDestination());
    68             synchronized (_existingLeaseSets) {
    69                 _existingLeaseSets.put(session.getMyDestination(), li);
    70             }
     65            _existingLeaseSets.put(session.getMyDestination(), li);
    7166            if (_log.shouldLog(Log.DEBUG))
    7267                _log.debug("Creating new leaseInfo keys for " 
Note: See TracChangeset for help on using the changeset viewer.