Click here to Skip to main content
15,900,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
Xeshan Ahmed 22-Oct-11 4:34am    
you have to store global lock state and on every transaction check the state of lock and make appropriate decision

1 solution

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 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900