Changeset 7f8efca
- Timestamp:
- Jul 5, 2013 7:05:54 PM (8 years ago)
- Branches:
- master
- Children:
- bec62c1b
- Parents:
- 76de4fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/streaming/java/src/net/i2p/client/streaming/ConnectionManager.java
r76de4fa r7f8efca 50 50 /** cache of the property to detect changes */ 51 51 private static volatile String _currentBlacklist = ""; 52 private static final Set<Hash> _globalBlacklist = new ConcurrentHashSet ();52 private static final Set<Hash> _globalBlacklist = new ConcurrentHashSet<Hash>(); 53 53 54 54 /** @since 0.9.3 */ … … 63 63 _defaultOptions = defaultOptions; 64 64 _log = _context.logManager().getLog(ConnectionManager.class); 65 _connectionByInboundId = new ConcurrentHashMap (32);66 _pendingPings = new ConcurrentHashMap (4);65 _connectionByInboundId = new ConcurrentHashMap<Long,Connection>(32); 66 _pendingPings = new ConcurrentHashMap<Long,PingRequest>(4); 67 67 _messageHandler = new MessageHandler(_context, this); 68 68 _packetHandler = new PacketHandler(_context, this); … … 444 444 synchronized(_globalBlacklist) { 445 445 if (hashes.length() > 0) { 446 Set<Hash> newSet = new HashSet ();446 Set<Hash> newSet = new HashSet<Hash>(); 447 447 StringTokenizer tok = new StringTokenizer(hashes, ",; "); 448 448 while (tok.hasMoreTokens()) { … … 548 548 */ 549 549 public Set<Connection> listConnections() { 550 return new HashSet (_connectionByInboundId.values());550 return new HashSet<Connection>(_connectionByInboundId.values()); 551 551 } 552 552 … … 564 564 * @param tagsToSend ignored 565 565 */ 566 public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set tagsToSend, PingNotifier notifier) {566 public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set<?> tagsToSend, PingNotifier notifier) { 567 567 return ping(peer, timeoutMs, blocking, notifier); 568 568 } … … 579 579 // packet.setTagsSent(tagsToSend); 580 580 //} 581 582 PingRequest req = new PingRequest(peer, packet, notifier); 581 if (_log.shouldLog(Log.INFO)) { 582 _log.info(String.format("about to ping %s timeout=%d blocking=%b", 583 peer,timeoutMs,blocking)); 584 } 585 586 587 PingRequest req = new PingRequest(notifier); 583 588 584 589 _pendingPings.put(id, req); … … 631 636 private final PingNotifier _notifier; 632 637 633 public PingRequest( Destination peer, PacketLocal packet,PingNotifier notifier) {638 public PingRequest(PingNotifier notifier) { 634 639 _notifier = notifier; 635 640 } … … 639 644 //_log.debug("Ping successful"); 640 645 //_context.sessionKeyManager().tagsDelivered(_peer.getPublicKey(), _packet.getKeyUsed(), _packet.getTagsSent()); 641 synchronized ( ConnectionManager.PingRequest.this) {646 synchronized (this) { 642 647 _ponged = true; 643 ConnectionManager.PingRequest.this.notifyAll();648 notifyAll(); 644 649 } 645 650 if (_notifier != null) 646 651 _notifier.pingComplete(true); 647 652 } 648 public boolean pongReceived() { return _ponged; }653 public synchronized boolean pongReceived() { return _ponged; } 649 654 } 650 655
Note: See TracChangeset
for help on using the changeset viewer.