I have a JAX-RS service:
@GET
@Path("/foo")
/* ... */
public Response show() {
// Execute an async task here
return Response.ok().entity(result).build();
}
I am aware we can create a thread pool service, or use the JVM commonPool()
, but I wonder if there is an internal thread pool in JAX-RS standard or implementation (I use Jersey with Jetty) eg the thread pool for handling the requests?
Found out ExecutorServiceProvider
which can be injected directly in Jersey:
@Inject
private final ExecutorServiceProvider executorServiceProvider;
Then
ExecutorService executorService = executorServiceProvider.getExecutorService();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.