本文整理匯總了Java中org.eclipse.jetty.util.thread.QueuedThreadPool.setDetailedDump方法的典型用法代碼示例。如果您正苦於以下問題:Java QueuedThreadPool.setDetailedDump方法的具體用法?Java QueuedThreadPool.setDetailedDump怎麽用?Java QueuedThreadPool.setDetailedDump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.util.thread.QueuedThreadPool
的用法示例。
在下文中一共展示了QueuedThreadPool.setDetailedDump方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newInstance
import org.eclipse.jetty.util.thread.QueuedThreadPool; //導入方法依賴的package包/類
public static void newInstance(String host, int port, int maxThreads, int minThreads, int threadTimeoutMillis) {
TinyHandler tinyHandler = TinyHandler.get();
JettyHandler jettyHandler = new JettyHandler(tinyHandler);
QueuedThreadPool queuedThreadPool = new QueuedThreadPool(minThreads, maxThreads, threadTimeoutMillis);
queuedThreadPool.setDetailedDump(false);
Server server = new Server(queuedThreadPool);
ServerConnector connector = getConnector(server, host, port);
connector.setAcceptQueueSize(1000);
server = connector.getServer();
server.setConnectors(new Connector[]{connector});
server.setHandler(jettyHandler);
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
System.exit(100);
}
}
示例2: configureThreadPool
import org.eclipse.jetty.util.thread.QueuedThreadPool; //導入方法依賴的package包/類
private ThreadPool configureThreadPool(final int port) {
final QueuedThreadPool threadPool = new QueuedThreadPool(threadPoolCapacity);
threadPool.setMinThreads(minThreadCount);
threadPool.setMaxThreads(maxThreadCount);
threadPool.setName("Jetty thread pool [" + port + "]");
threadPool.setDetailedDump(true);
return threadPool;
}
示例3: configureThreadPool
import org.eclipse.jetty.util.thread.QueuedThreadPool; //導入方法依賴的package包/類
protected void configureThreadPool(QueuedThreadPool pool) {
// override QueuedThreadPool defaults
pool.setMaxThreads(jettyThreadPoolSettings.getMaxThreads());
pool.setMinThreads(jettyThreadPoolSettings.getMinThreads());
pool.setIdleTimeout(jettyThreadPoolSettings.getIdleTimeout());
pool.setDetailedDump(jettyThreadPoolSettings.isDetailedDump());
}
示例4: EmbeddedJetty
import org.eclipse.jetty.util.thread.QueuedThreadPool; //導入方法依賴的package包/類
public EmbeddedJetty(boolean isDebugMode) {
ArrayBlockingQueue<Runnable> queue = Queues.newArrayBlockingQueue(this.capability);
pool = new QueuedThreadPool(this.maxThreads, this.minThreads, this.idleTimeout, queue);
{
pool.setName("jetty");
pool.setDetailedDump(isDebugMode);
pool.setStopTimeout(this.stopTimeout);
}
this.server = new Server(pool);
this.server.setStopAtShutdown(true);
// set default error page to empty
if (false == isDebugMode) {
this.server.addBean(emtpyErrorPage);
emtpyErrorPage.setServer(this.server);
this.server.setDumpAfterStart(false);
this.server.setDumpBeforeStop(false);
}
this.httpConfig = new HttpConfiguration();
{
this.httpConfig.setSendServerVersion(false);
this.httpConfig.setSendXPoweredBy(false);
this.httpConfig.setSendDateHeader(true);
}
this.handlers = new HandlerCollection();
this.server.setHandler(handlers);
}
示例5: configureServerPerformance
import org.eclipse.jetty.util.thread.QueuedThreadPool; //導入方法依賴的package包/類
private Server configureServerPerformance(ServerConfig config) {
// Using thread pool for benchmark - this is not necessarily needed in ordinary setups
// Normal use is just:
// Server server = new Server(PORT);
QueuedThreadPool pool = new QueuedThreadPool();
pool.setDetailedDump(false);
switch(config.serverPerformance()) {
case HIGHEST:
pool.setMaxThreads(Runtime.getRuntime().availableProcessors() * 8);
pool.setMinThreads(Runtime.getRuntime().availableProcessors() * 8);
break;
case HIGH:
pool.setMaxThreads(Runtime.getRuntime().availableProcessors() * 2);
pool.setMinThreads(Math.min(Runtime.getRuntime().availableProcessors(), 4));
break;
case MEDIUM:
pool.setMaxThreads(Math.min(Runtime.getRuntime().availableProcessors(), 4));
pool.setMinThreads(4);
break;
case LOW:
pool.setMaxThreads(4);// A minimum of 4 threads are needed for Jetty to run
pool.setMinThreads(4);
break;
case CUSTOM:
pool.setMaxThreads(config.ioThreads());
pool.setMinThreads(config.ioThreads());
break;
}
Server server = new Server(pool);
ServerConnector connector = new ServerConnector(server);
connector.setAcceptQueueSize(config.backlog());
connector.setPort(config.port());
server.setConnectors(new ServerConnector[] {connector});
return server;
}