return camelServlet;
}
protected Server createServer() throws Exception {
Server server = new Server();
ContextHandlerCollection collection = new ContextHandlerCollection();
server.setHandler(collection);
// configure thread pool if min/max given
if (minThreads != null || maxThreads != null) {
if (getThreadPool() != null) {
throw new IllegalArgumentException("You cannot configure both minThreads/maxThreads and a custom threadPool on JettyHttpComponent: " + this);
}
QueuedThreadPool qtp = new QueuedThreadPool();
if (minThreads != null) {
qtp.setMinThreads(minThreads.intValue());
}
if (maxThreads != null) {
qtp.setMaxThreads(maxThreads.intValue());
}
// let the thread names indicate they are from the server
qtp.setName("CamelJettyServer(" + ObjectHelper.getIdentityHashCode(server) + ")");
try {
qtp.start();
} catch (Exception e) {
throw new RuntimeCamelException("Error starting JettyServer thread pool: " + qtp, e);
}
server.setThreadPool(qtp);
}
if (getThreadPool() != null) {
server.setThreadPool(getThreadPool());
}
return server;
}