使用 Timer.schedule 在 Grizzly 上的 Jersey 上以任意时间响应

发布于 2024-10-18 15:20:36 字数 264 浏览 9 评论 0原文

全部。提前致谢。

我正在 Grizzly 上使用 Jersey 创建 RESTful 服务。在服务中,我想使用“Timer.schedule”等待响应请求几秒钟,而不是使用“Thread.sleep”,这是一个阻塞操作。

然而,“返回”似乎是泽西岛回应请求的唯一方式。所以,我还没有找到方法来做到这一点。如果您有任何想法这样做,请告诉我如何做到这一点?

我正在使用 Jersey-1.4 和 Grizzly-1.9.32,没有 Maven。
非常感谢。此致。

all. Thanks in advance.

I am creating a RESTful service with Jersey on Grizzly. In the service, I would like to wait responding to a request for several seconds using "Timer.schedule", instead of using "Thread.sleep", which is a blocking operation.

However, "return" seems to be an only way to respond a request in Jersey. So, I have not figured out the way to do this. If you have any idea doing this, would you please advice me how to do this?

I am using Jersey-1.4 and Grizzly-1.9.32, without Maven.
Thank you very much. Best regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江城子 2024-10-25 15:20:36

看看这个问题,可能对你有帮助。

Take a look at this question, it may be of help to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文