Changeset f92d8ae


Ignore:
Timestamp:
Aug 11, 2012 11:34:32 AM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1538cd84
Parents:
f6c7691
Message:

make context list concurrent

File:
1 edited

Legend:

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

    rf6c7691 rf92d8ae  
    77import java.util.Set;
    88import java.util.concurrent.CopyOnWriteArraySet;
     9import java.util.concurrent.CopyOnWriteArrayList;
    910
    1011import net.i2p.I2PAppContext;
     
    6263    private final Object _lock1 = new Object(), _lock2 = new Object();
    6364
    64     private static List<RouterContext> _contexts = new ArrayList(1);
     65    private static final List<RouterContext> _contexts = new CopyOnWriteArrayList();
    6566   
    6667    public RouterContext(Router router) { this(router, null); }
     68
    6769    public RouterContext(Router router, Properties envProps) {
    6870        super(filterProps(envProps));
     
    7577        if (!_contexts.isEmpty())
    7678            System.err.println("Warning - More than one router in this JVM");
     79        _finalShutdownTasks = new CopyOnWriteArraySet();
    7780        _contexts.add(this);
    78         _finalShutdownTasks = new CopyOnWriteArraySet();
    7981    }
    8082
     
    188190     * MultiRouter is going on).
    189191     *
    190      * @return an unmodifiable list (as of 0.8.8). May be null or empty.
     192     * @return an unmodifiable list (as of 0.8.8). May be empty.
    191193     */
    192194    public static List<RouterContext> listContexts() {
Note: See TracChangeset for help on using the changeset viewer.