<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Persistence and Locking</title>
	<atom:link href="http://pitfalls.wordpress.com/2008/04/07/persistence-and-locking/feed/" rel="self" type="application/rss+xml" />
	<link>http://pitfalls.wordpress.com/2008/04/07/persistence-and-locking/</link>
	<description></description>
	<lastBuildDate>Tue, 11 Aug 2009 16:12:23 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: apnath</title>
		<link>http://pitfalls.wordpress.com/2008/04/07/persistence-and-locking/#comment-7</link>
		<dc:creator>apnath</dc:creator>
		<pubDate>Tue, 08 Apr 2008 09:01:02 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=7#comment-7</guid>
		<description>The approach suggested centralized locking which manages locks, by managing I meant initiating the calls for getting and releasing the locks. The actual locks would be maintained at the db end. The whole idea is to spare individual methods from the locking parlance and decide it at a central level on the basis of flows. For example for two flows:
1. That deposits money into an account
2. Shows account balance
We would need to get the account details from the account table, assuming that we wanted to lock the account details while making the deposit in case 1, the centralized manager would help us do so without coding special method for selecting the accounts.
The lock obtained by the centralized manager is actually a db lock, in short the centralized manager would decide if the sql to be executed is a &quot;FOR UPDATE&quot; sql or otherwise. It could fit in more locking semantics as the need arises.</description>
		<content:encoded><![CDATA[<p>The approach suggested centralized locking which manages locks, by managing I meant initiating the calls for getting and releasing the locks. The actual locks would be maintained at the db end. The whole idea is to spare individual methods from the locking parlance and decide it at a central level on the basis of flows. For example for two flows:<br />
1. That deposits money into an account<br />
2. Shows account balance<br />
We would need to get the account details from the account table, assuming that we wanted to lock the account details while making the deposit in case 1, the centralized manager would help us do so without coding special method for selecting the accounts.<br />
The lock obtained by the centralized manager is actually a db lock, in short the centralized manager would decide if the sql to be executed is a &#8220;FOR UPDATE&#8221; sql or otherwise. It could fit in more locking semantics as the need arises.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Otaguro</title>
		<link>http://pitfalls.wordpress.com/2008/04/07/persistence-and-locking/#comment-4</link>
		<dc:creator>David Otaguro</dc:creator>
		<pubDate>Mon, 07 Apr 2008 16:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=7#comment-4</guid>
		<description>The only issue with the idea of &quot;the central lock manager [that is] aware of all the flows and the locks&quot; is that concurrency issues between clustered applications can&#039;t be handled by a centralized lock manager unless you&#039;re willing to make the centralized lock manager a clustered beast itself, which becomes potentially problematic.

The database itself already has an excellent centralized lock manager... rather than locking rows in the actual tables and manipulating the lockmode of the selects, it might be better to use semaphores obtained from a table explicitly for the purpose of controlling locking behavior, for example a table called, LOCK_SEMAPHORES or somesuch.  That makes the table the source of lock data (for the application), if necessary you can use the database&#039;s utilities for lock manipulation to deal with lock problems, and you can distribute your locking manager with the shared lock state explicitly visible in the locks table.

Just a thought.</description>
		<content:encoded><![CDATA[<p>The only issue with the idea of &#8220;the central lock manager [that is] aware of all the flows and the locks&#8221; is that concurrency issues between clustered applications can&#8217;t be handled by a centralized lock manager unless you&#8217;re willing to make the centralized lock manager a clustered beast itself, which becomes potentially problematic.</p>
<p>The database itself already has an excellent centralized lock manager&#8230; rather than locking rows in the actual tables and manipulating the lockmode of the selects, it might be better to use semaphores obtained from a table explicitly for the purpose of controlling locking behavior, for example a table called, LOCK_SEMAPHORES or somesuch.  That makes the table the source of lock data (for the application), if necessary you can use the database&#8217;s utilities for lock manipulation to deal with lock problems, and you can distribute your locking manager with the shared lock state explicitly visible in the locks table.</p>
<p>Just a thought.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Veentjer</title>
		<link>http://pitfalls.wordpress.com/2008/04/07/persistence-and-locking/#comment-3</link>
		<dc:creator>Peter Veentjer</dc:creator>
		<pubDate>Mon, 07 Apr 2008 15:56:21 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=7#comment-3</guid>
		<description>Using an isolation level is declarative form of concurrency control in databases. In most cases using the correct isolation level prevents setting any lock yourself. The database also is the central place where all locks are managed (not some jvm) and the database uses different strategies to deal-with/prevent deadlocks. In some cases using a time out can be enough, but also the inference of a deadlock is done. So when using a database, deadlocks are not my main worry.

So the database is a very very advances mechanism for concurrency control. You could even say that in some areas it is much more advanced than Java (for example Multi Version Concurrency Control: MVCC) to improve upon concurrency by providing multiple versions of the same data.</description>
		<content:encoded><![CDATA[<p>Using an isolation level is declarative form of concurrency control in databases. In most cases using the correct isolation level prevents setting any lock yourself. The database also is the central place where all locks are managed (not some jvm) and the database uses different strategies to deal-with/prevent deadlocks. In some cases using a time out can be enough, but also the inference of a deadlock is done. So when using a database, deadlocks are not my main worry.</p>
<p>So the database is a very very advances mechanism for concurrency control. You could even say that in some areas it is much more advanced than Java (for example Multi Version Concurrency Control: MVCC) to improve upon concurrency by providing multiple versions of the same data.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
