comparison src/org/eclipse/jetty/server/AbstractConnector.java @ 865:6b210bb66c63

remove ThreadPool
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 02 Oct 2016 20:38:06 -0600
parents e21ca9878a10
children 688b875e18ba
comparison
equal deleted inserted replaced
864:e21ca9878a10 865:6b210bb66c63
20 20
21 import java.io.IOException; 21 import java.io.IOException;
22 import java.net.InetAddress; 22 import java.net.InetAddress;
23 import java.net.Socket; 23 import java.net.Socket;
24 import java.net.UnknownHostException; 24 import java.net.UnknownHostException;
25 import java.util.concurrent.ThreadPoolExecutor;
25 import java.util.concurrent.atomic.AtomicLong; 26 import java.util.concurrent.atomic.AtomicLong;
26 27
27 import javax.servlet.ServletRequest; 28 import javax.servlet.ServletRequest;
28 29
29 import org.eclipse.jetty.http.HttpBuffers; 30 import org.eclipse.jetty.http.HttpBuffers;
38 import org.eclipse.jetty.io.EofException; 39 import org.eclipse.jetty.io.EofException;
39 import org.eclipse.jetty.util.component.AggregateLifeCycle; 40 import org.eclipse.jetty.util.component.AggregateLifeCycle;
40 import org.eclipse.jetty.util.component.Dumpable; 41 import org.eclipse.jetty.util.component.Dumpable;
41 import org.slf4j.Logger; 42 import org.slf4j.Logger;
42 import org.slf4j.LoggerFactory; 43 import org.slf4j.LoggerFactory;
43 import org.eclipse.jetty.util.thread.ThreadPool;
44 44
45 /** 45 /**
46 * Abstract Connector implementation. This abstract implementation of the Connector interface provides: 46 * Abstract Connector implementation. This abstract implementation of the Connector interface provides:
47 * <ul> 47 * <ul>
48 * <li>AbstractLifeCycle implementation</li> 48 * <li>AbstractLifeCycle implementation</li>
110 { 110 {
111 _server = server; 111 _server = server;
112 } 112 }
113 113
114 /* ------------------------------------------------------------ */ 114 /* ------------------------------------------------------------ */
115 public ThreadPool getThreadPool() 115 public ThreadPoolExecutor getThreadPool()
116 { 116 {
117 return _server.getThreadPool(); 117 return _server.getThreadPool();
118 } 118 }
119 119
120 /* ------------------------------------------------------------ */ 120 /* ------------------------------------------------------------ */
295 // Start selector thread 295 // Start selector thread
296 synchronized (this) 296 synchronized (this)
297 { 297 {
298 _acceptorThreads = new Thread[getAcceptors()]; 298 _acceptorThreads = new Thread[getAcceptors()];
299 299
300 ThreadPool _threadPool = getThreadPool(); 300 ThreadPoolExecutor _threadPool = getThreadPool();
301 for (int i = 0; i < _acceptorThreads.length; i++) 301 for (int i = 0; i < _acceptorThreads.length; i++)
302 if (!_threadPool.dispatch(new Acceptor(i))) 302 _threadPool.execute(new Acceptor(i));
303 throw new IllegalStateException("!accepting"); 303 if (_server.isLowOnThreads())
304 if (_threadPool.isLowOnThreads())
305 LOG.warn("insufficient threads configured for {}",this); 304 LOG.warn("insufficient threads configured for {}",this);
306 } 305 }
307 306
308 LOG.info("Started {}",this); 307 LOG.info("Started {}",this);
309 } 308 }
1010 { 1009 {
1011 _reuseAddress = reuseAddress; 1010 _reuseAddress = reuseAddress;
1012 } 1011 }
1013 1012
1014 /* ------------------------------------------------------------ */ 1013 /* ------------------------------------------------------------ */
1015 public boolean isLowResources() 1014 public final boolean isLowResources()
1016 { 1015 {
1017 return getThreadPool().isLowOnThreads(); 1016 return _server.isLowOnThreads();
1018 } 1017 }
1019 1018
1020 /* ------------------------------------------------------------ */ 1019 /* ------------------------------------------------------------ */
1021 private void updateNotEqual(AtomicLong valueHolder, long compare, long value) 1020 private void updateNotEqual(AtomicLong valueHolder, long compare, long value)
1022 { 1021 {