<?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/"
		>
<channel>
	<title>Comments on: Java Concurrency Bugs #2 &#8211; what to synchronize on</title>
	<atom:link href="http://tech.puredanger.com/index.php/2009/01/28/java-concurrency-bugs-synchronize-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/</link>
	<description>Alex Miller&#039;s technical blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:39:50 -0800</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: Alex</title>
		<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/comment-page-1/#comment-260267</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 03 Nov 2010 01:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/#comment-260267</guid>
		<description>@Jack: As I say above, it&#039;s generally a bad idea to synchronize on a string, especially if you don&#039;t how it was created.  If that String was interned or created as a &quot;abc&quot; string literal, then another String elsewhere is identical (due to interning) and you might be sharing lock scopes when you don&#039;t expect it.  It is possible for locking on Strings to be safe if you know how those strings are created (for example with new String(...)).</description>
		<content:encoded><![CDATA[<p>@Jack: As I say above, it&#8217;s generally a bad idea to synchronize on a string, especially if you don&#8217;t how it was created.  If that String was interned or created as a &#8220;abc&#8221; string literal, then another String elsewhere is identical (due to interning) and you might be sharing lock scopes when you don&#8217;t expect it.  It is possible for locking on Strings to be safe if you know how those strings are created (for example with new String(&#8230;)).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/comment-page-1/#comment-260265</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Tue, 02 Nov 2010 23:27:16 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/#comment-260265</guid>
		<description>public doSomething(String st) {

synchronized(st) {
….
}

}

Can I do the above? Or do you see any issues?

Thanks</description>
		<content:encoded><![CDATA[<p>public doSomething(String st) {</p>
<p>synchronized(st) {<br />
….<br />
}</p>
<p>}</p>
<p>Can I do the above? Or do you see any issues?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Lewis</title>
		<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/comment-page-1/#comment-138999</link>
		<dc:creator>Dan Lewis</dc:creator>
		<pubDate>Fri, 30 Jan 2009 14:17:43 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/#comment-138999</guid>
		<description>Thanks for sharing these</description>
		<content:encoded><![CDATA[<p>Thanks for sharing these</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/comment-page-1/#comment-138909</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 30 Jan 2009 04:08:24 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/#comment-138909</guid>
		<description>@Tuure:  I don&#039;t think it&#039;s misleading.  But it may be badly worded. :)  I hear what you&#039;re saying.  That&#039;s the benefit of putting this stuff on the web and getting feedback of course.  By the time it makes it into a talk I&#039;ll have figured out what the hell I&#039;m talking about. Thanks...</description>
		<content:encoded><![CDATA[<p>@Tuure:  I don&#8217;t think it&#8217;s misleading.  But it may be badly worded. :)  I hear what you&#8217;re saying.  That&#8217;s the benefit of putting this stuff on the web and getting feedback of course.  By the time it makes it into a talk I&#8217;ll have figured out what the hell I&#8217;m talking about. Thanks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tuure Laurinolli</title>
		<link>http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/comment-page-1/#comment-138874</link>
		<dc:creator>Tuure Laurinolli</dc:creator>
		<pubDate>Fri, 30 Jan 2009 00:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/28/java-concurrency-bugs-synchronize-object/#comment-138874</guid>
		<description>Number one is a bit misleading. &quot;#1: Don’t synchronize on a variable you&#039;re reassigning&quot; would be better, but not quite spot-on accurate either since you&#039;re synchonizing on the object and not the variable, which is what causes the problem in the first place :)</description>
		<content:encoded><![CDATA[<p>Number one is a bit misleading. &#8220;#1: Don’t synchronize on a variable you&#8217;re reassigning&#8221; would be better, but not quite spot-on accurate either since you&#8217;re synchonizing on the object and not the variable, which is what causes the problem in the first place :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

