锁定和处理并发

编程入门 行业动态 更新时间:2024-10-27 00:34:52
本文介绍了锁定和处理并发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的团队, 我正在开发一个Web应用程序,问题是如何处理锁定.... 例如,我有一个TransactionId = 1234,并且其他用户打开了它,因此如果他/她尝试打开与用户锁定TransactionId(1234)相同的交易ID(1234),它应该向另一个用户提示一条消息(用户名)在此(MachineName)机器上. 谢谢 Sukhen Dass

Dear Team, I am developing a web application and the problem is how to handle Locking.... For ex.I have a TransactionId=1234 and it is opened by some other user so it should prompt a message to another user if he/she try to open the same transaction Id(1234) that TransactionId(1234) is locked by user(username) on this(MachineName) machine. Thanks Sukhen Dass

推荐答案

您所描述的是悲观并发.这不是一件容易的事,而且我认为任何人都无法轻易回答.但是,您可以检查一些链接. 什么是悲观并发 [ ^ ],并发控制简介 [ ^ ],乐观和悲观并发-一个简单的解释 [ ^ ]. 如您所见,悲观并发有一些含义,死锁可能是最危险的.可能有多种方法可以解决此问题.某些ORM可能可以为您处理此问题,例如 Teleriks OpenAccess ORM [^ ].例如,您还可以使用跟踪谁锁定什么实体的服务.但是再一次,确实没有简单的方法可以做到这一点. 我希望这至少对您有所帮助,即使它并不能真正回答您的问题:) What you describe is Pessimistic Concurrency. This is no easy task and I don''t think anyone will be able to easily answer that. However there are some links you could check. What is Pessimistic Concurrency[^], Introduction to Concurrency Control[^], Optimistic and Pessimistic Concurrency - A Simple Explanation[^]. As you can read there are some implications with pessimistic concurrency, deadlock possibly being the most dangerous. There are probably various way to handle this. Some ORM''s might be able to handle this for you, such as Teleriks OpenAccess ORM[^]. You could also use, for example, a service that keeps track of who locks what entity. But once again, there really is no easy way to do this. I hope this is at least somewhat helpful, even though it does not really answer your question :)

更多推荐

锁定和处理并发

本文发布于:2023-11-10 01:51:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574028.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!