本文整理匯總了Java中org.eclipse.jetty.server.Server.setThreadPool方法的典型用法代碼示例。如果您正苦於以下問題:Java Server.setThreadPool方法的具體用法?Java Server.setThreadPool怎麽用?Java Server.setThreadPool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.server.Server
的用法示例。
在下文中一共展示了Server.setThreadPool方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startInJvmProxy
import org.eclipse.jetty.server.Server; //導入方法依賴的package包/類
/**
* To test that the CF client is able to go through a proxy, we point the CC client to a broken url that can only be resolved by going
* through an inJVM proxy which rewrites the URI. This method starts this inJvm proxy.
*
* @throws Exception
*/
private static void startInJvmProxy() throws Exception {
inJvmProxyPort = getNextAvailablePort(8080);
inJvmProxyServer = new Server(new InetSocketAddress("127.0.0.1", inJvmProxyPort)); // forcing use of loopback
// that will be used both for Httpclient proxy and SocketDestHelper
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMinThreads(1);
inJvmProxyServer.setThreadPool(threadPool);
HandlerCollection handlers = new HandlerCollection();
inJvmProxyServer.setHandler(handlers);
ServletHandler servletHandler = new ServletHandler();
handlers.addHandler(servletHandler);
nbInJvmProxyRcvReqs = new AtomicInteger();
ChainedProxyServlet chainedProxyServlet = new ChainedProxyServlet(httpProxyConfiguration, nbInJvmProxyRcvReqs);
servletHandler.addServletWithMapping(new ServletHolder(chainedProxyServlet), "/*");
// Setup proxy handler to handle CONNECT methods
ConnectHandler proxyHandler;
proxyHandler = new ChainedProxyConnectHandler(httpProxyConfiguration, nbInJvmProxyRcvReqs);
handlers.addHandler(proxyHandler);
inJvmProxyServer.start();
}