Skip to content

Instantly share code, notes, and snippets.

@ygaller
Created July 24, 2017 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ygaller/abadd92d34ac5e8eeadbf7325c568419 to your computer and use it in GitHub Desktop.
Save ygaller/abadd92d34ac5e8eeadbf7325c568419 to your computer and use it in GitHub Desktop.
public class EmbeddedJettyFactoryConstructor {
AbstractNCSARequestLog requestLog;
public EmbeddedJettyFactoryConstructor(AbstractNCSARequestLog requestLog) {
this.requestLog = requestLog;
}
EmbeddedJettyFactory create() {
return new EmbeddedJettyFactory((maxThreads, minThreads, threadTimeoutMillis) -> {
Server server;
if (maxThreads > 0) {
int max = maxThreads > 0 ? maxThreads : 200;
int min = minThreads > 0 ? minThreads : 8;
int idleTimeout = threadTimeoutMillis > 0 ? threadTimeoutMillis : '\uea60';
server = new Server(new QueuedThreadPool(max, min, idleTimeout));
} else {
server = new Server();
}
server.setRequestLog(requestLog);
return server;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment