java - Jersey InvocationCallback Completed:哪个线程用于调用这些方法
问题描述
我正在研究异步处理模块并实施 Jersey 调用回调。
我的实现很简单,我定义了一个 Completed 和 Failed 方法,如 https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/InvocationCallback.html中所述
并根据 https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/async.html#d0e10417
调查球衣中后台调用的正确处理我知道这是调用异步回调选项的正确方法。
但是我无法理解哪个线程将用于调用回调选项?Jersey 是否使用 forkjoinpool.commonPool 来执行这些?
解决方案
从 Jersey 源代码中,它基于 threadpool 属性创建了一个线程池
jersey.config.client.async.threadPoolSize
通过,默认为 0
public ClientRuntime(ClientConfig config, Connector connector, ServiceLocator locator) {
Builder<ClientRequest> requestingChainBuilder = Stages.chain((Function)locator.createAndInitialize(RequestProcessingInitializationStage.class));
int asyncThreadPoolSize = (Integer)PropertiesHelper.getValue(config.getProperties(), "jersey.config.client.async.threadPoolSize", 0);
asyncThreadPoolSize = asyncThreadPoolSize < 0 ? 0 : asyncThreadPoolSize;
this.asyncExecutorsFactory = new ClientAsyncExecutorFactory(locator, asyncThreadPoolSize);
}
推荐阅读
- jsf - 未找到来自外部 Web 项目的引用组合
- android - Apollo codegen 安装任务上的 Apollo Android 错误
- reactjs - React:我有一些行为适用于包含整个项目的包装器。但我希望我的中央 div 不受这种行为的影响
- java - 基于自定义属性的 Spring Boot SOAP Web 服务的 Keycloak 身份验证
- node.js - 尝试将 API 结果推送到数组但返回为空
- assembly - 共享 RISC-V 图形库的地方
- python - 尝试在 Jupyter 笔记本中运行 pyspark 时出现错误 java.io.IOException:无法连接到
- reactjs - 间歇性网络::ERR_CONNECTION_RESET 200 (OK)
- python - 如何在 Kivy 中浏览屏幕?
- windows - 更改 KernelBase.dll 后电脑无法启动?