使用 CompletableFuture 调用存储过程
我有一个 Springboot API,它使用可调用语句最多进行 6 次存储过程调用。我想让这个调用异步。是否可以使用 CompleteableFuture(java8) 来实现这一点???
I have a Springboot API that makes a maximum of 6 Stored Procedure calls using the callable statement. I want to make this call asynchronous. Is it possible to achieve this using CompleteableFuture(java8)???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据库连接通常不是线程安全的。您计划每次通话使用一个连接吗?
如果是,以下代码将并行执行可调用语句。请注意,我使用了 vavr 库来简化异常处理。
Database connections are typically not thread-safe. Are you planning to use one connection per call?
If yes, following code will execute the callable statements in parallel. Please note I have used vavr library to simplify the exception handling.