锁定和处理并发 [英] Locking and Handling Concurrency

查看:112
本文介绍了锁定和处理并发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的团队,

我正在开发一个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

推荐答案

您所描述的是悲观并发.这不是一件容易的事,而且我认为任何人都无法轻易回答.但是,您可以检查一些链接. 什么是悲观并发 [并发控制简介 [ ^ ], 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 :)


这篇关于锁定和处理并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆