当前位置: 首页>>代码示例>>Java>>正文


Java Server.setThreadPool方法代码示例

本文整理汇总了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();
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:31,代码来源:CloudFoundryClientTest.java


注:本文中的org.eclipse.jetty.server.Server.setThreadPool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。