控制器连接终止后(即客户端超时)事务回滚
想象一下场景; 我有一个移动应用程序,它从 Spring 管理的服务器中提取 20 美元,并等待确认,然后在应用程序上将其标记为完成。
然而;
移动应用程序将提款请求发送到服务器
控制器接收请求并调用服务器层服务层如何花费异常长的时间来提款钱(原因不重要)。
移动应用程序超时(带有 SocketException),并且请求将重新排队,直到它可以再次与应用程序通信。
服务器完成了从1开始的请求,但不知道客户端已超时。
我们现在的场景是,移动应用程序认为 20 美元失败,但服务器执行了请求。
所以问题;
• 当套接字关闭时(即当移动应用程序超时请求时),Spring 事务是否可以回滚?
• 如果不是——实现上述目标的最佳方法是什么?
服务器上的一些信息 • 春季3.1 • 基于Spring 的控制器/服务/DAO。 • 休眠 (JPA) • MYSQL 数据存储
谢谢,
Ian。
Picture the scene;
I have a mobile App that withdraws $20 from a Spring managed Server and waits for confirmation before marking it complete on the app.
However;
Mobile app sends the withdraw request to the server
Controller receives the request and calls the server tier how service tier takes an un-usually long time to withdraw the money (reason not important ).
Mobile App times out (with a SocketException) and the request is re-queued until it can speak to the application again.
The Server completes the request from 1 but does not know the client has timed out.
We now have the scenario in that the mobile application believes the 20 dollars failed but the server carried out the request.
So the questions;
• Can Spring transactions Rollback when sockets are closed (i.e. when the mobile application times out the request)?
• If not – what is the best approach to achieve the above?
Some info on the server
• Spring 3.1
• Spring based controllers/services/DAO's.
• Hibernate (JPA)
• MYSQL Data store
Thanks,
Ian.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前我无法想象这会如何运作......
我会这样处理问题:
希望有帮助。
At the moment I can't imagine how that might work ...
I would deal with the problem like this:
Hope that helps.