Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DGS-19645: support to configure server with supplied thread pool #545

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/src/main/java/io/confluent/rest/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import org.eclipse.jetty.util.resource.ResourceCollection;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
import org.glassfish.jersey.server.ResourceConfig;
Expand Down Expand Up @@ -306,6 +307,21 @@ public Server createServer() throws ServletException {
return server;
}

/**
* Configure and create the server.
*
* @param threadPool thread pool to use for the server
* @return server instance created with the given thread pool
* @throws ServletException if the server cannot be created
*/
public Server createServer(ThreadPool threadPool) throws ServletException {
if (server == null) {
server = new ApplicationServer<>(config, threadPool);
server.registerApplication(this);
}
return server;
}

final void setServer(ApplicationServer<?> server) {
this.server = Objects.requireNonNull(server);
}
Expand Down