Changeset adab0cc


Ignore:
Timestamp:
Oct 24, 2010 4:55:29 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4f9c442
Parents:
b1f17255
Message:
  • NTCP: Catch a race after stop()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/ntcp/NTCPSendFinisher.java

    rb1f17255 radab0cc  
    33import java.util.concurrent.Executors;
    44import java.util.concurrent.LinkedBlockingQueue;
     5import java.util.concurrent.RejectedExecutionException;
    56import java.util.concurrent.ThreadPoolExecutor;
    67import java.util.concurrent.TimeUnit;
     
    2526public class NTCPSendFinisher {
    2627    private static final int THREADS = 4;
    27     private I2PAppContext _context;
    28     private NTCPTransport _transport;
    29     private Log _log;
     28    private final I2PAppContext _context;
     29    private final NTCPTransport _transport;
     30    private final Log _log;
    3031    private int _count;
    3132    private ThreadPoolExecutor _executor;
     
    4849
    4950    public void add(OutNetMessage msg) {
    50         _executor.execute(new RunnableEvent(msg));
     51        try {
     52            _executor.execute(new RunnableEvent(msg));
     53        } catch (RejectedExecutionException ree) {
     54            // race with stop()
     55            _log.warn("NTCP send finisher stopped, discarding msg.afterSend()");
     56        }
    5157    }
    5258   
Note: See TracChangeset for help on using the changeset viewer.