用spring进行多线程Context初始化?

发布于 2024-09-30 11:07:26 字数 142 浏览 1 评论 0原文

我有一个带有 spring 的传统三层应用程序。我的存储库之一需要 >初始化需要 3 分钟,所以我考虑了一些多线程方法来加速整个过程 - 我认为依赖树中的大多数服务和控制器已经可以启动,因此只有少数必须等待最后一个存储库出现。

有没有最佳实践方法?

I have a traditional 3-tier application with spring. One of my repositories needs > 3 minutes for initialization so I thought about some multi-threaded approach in order to speed up the whole process - I think most service and controllers in my dependency tree can already be started so only a few must wait for the last repository to come up.

Is there any best practice approach?

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

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

发布评论

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

评论(1

镜花水月 2024-10-07 11:07:26

使用 Spring 的 Executor 抽象。如果您在应用程序服务器中,那么我建议您使用应用程序服务器的工作管理器(spring 支持它)。例如,WebSphere 应用程序服务器和 Weblogic 都支持在 JNDI 中注册工作管理器。然后您可以将 jndi 名称传递给 spring。 任务执行器

Use Spring's Executor abstraction. And if you are within a app server then I suggest you use application server's work-manager (spring supports it). For e.g. WebSphere app server and Weblogic both support registering the workmanagers in JNDI. You can then pass the jndi name to spring. Task Executors

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