Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
#1 bug fix for threadPool customize
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Dec 20, 2016
1 parent 5eddad3 commit b1177ff
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void customize(ConfigurableEmbeddedServletContainer container) {

JettyEmbeddedServletContainerFactory jettyFactory = (JettyEmbeddedServletContainerFactory) container;

customizeThreadPool((QueuedThreadPool) jettyFactory.getThreadPool());
customizeThreadPool(jettyFactory);

jettyFactory.addServerCustomizers(new JettyServerCustomizer() {

Expand Down Expand Up @@ -91,8 +91,14 @@ private void customizeSpringTimeHanlder(Server server) {
});
}

private void customizeThreadPool(QueuedThreadPool threadPool) {
private void customizeThreadPool(JettyEmbeddedServletContainerFactory jettyFactory) {
QueuedThreadPool threadPool = (QueuedThreadPool) jettyFactory.getThreadPool();
if (threadPool == null) {
threadPool = new QueuedThreadPool();
jettyFactory.setThreadPool(threadPool);
}
threadPool.setMaxThreads(maxThreads);
threadPool.setIdleTimeout(10000);
}

public void setMaxThreads(Integer maxThreads) {
Expand Down

0 comments on commit b1177ff

Please sign in to comment.