Changeset 8034dc3c


Ignore:
Timestamp:
Jul 17, 2011 7:15:16 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
91f2206
Parents:
0a8abad7
Message:

concurrent, final

Location:
apps/i2ptunnel/java/src/net/i2p/i2ptunnel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java

    r0a8abad7 r8034dc3c  
    7979    private final long _tunnelId;
    8080    private final Properties _clientOptions;
    81     private final List<I2PSession> _sessions;
     81    private final Set<I2PSession> _sessions;
    8282
    8383    public static final int PACKET_DELAY = 100;
     
    121121        Properties p = _context.getProperties();
    122122        _clientOptions = p;
    123         _sessions = new ArrayList(1);
     123        _sessions = new CopyOnWriteArraySet();
    124124       
    125125        addConnectionEventListener(lsnr);
     
    193193    /** @return non-null */
    194194    List<I2PSession> getSessions() {
    195         synchronized (_sessions) {
    196195            return new ArrayList(_sessions);
    197         }
    198     }
     196    }
     197
    199198    void addSession(I2PSession session) {
    200199        if (session == null) return;
    201         synchronized (_sessions) {
    202             if (!_sessions.contains(session))
    203                 _sessions.add(session);
    204         }
    205     }
     200        _sessions.add(session);
     201    }
     202
    206203    void removeSession(I2PSession session) {
    207204        if (session == null) return;
    208         synchronized (_sessions) {
    209             _sessions.remove(session);
    210         }
     205        _sessions.remove(session);
    211206    }
    212207   
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java

    r0a8abad7 r8034dc3c  
    2929 */
    3030public class TunnelController implements Logging {
    31     private Log _log;
     31    private final Log _log;
    3232    private Properties _config;
    33     private I2PTunnel _tunnel;
    34     private List<String> _messages;
     33    private final I2PTunnel _tunnel;
     34    private final List<String> _messages;
    3535    private List<I2PSession> _sessions;
    3636    private boolean _running;
Note: See TracChangeset for help on using the changeset viewer.