<?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 #1 &#8211; mutable statics</title>
	<atom:link href="http://tech.puredanger.com/index.php/2009/01/27/java-concurrency-bugs-mutable-statics/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/</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: Chris Dennis</title>
		<link>http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/comment-page-1/#comment-138422</link>
		<dc:creator>Chris Dennis</dc:creator>
		<pubDate>Tue, 27 Jan 2009 23:12:08 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/#comment-138422</guid>
		<description>Another small tool that can be useful here is Bill Pugh&#039;s &lt;a href=&quot;http://code.google.com/p/checked-uncontended-lock/&quot; rel=&quot;nofollow&quot;&gt;checked-uncontended-lock&lt;/a&gt;.  It allows you to &#039;assert&#039; that a lock is uncontended.

Of course just because you don&#039;t see any contention doesn&#039;t mean there won&#039;t be any in the future.</description>
		<content:encoded><![CDATA[<p>Another small tool that can be useful here is Bill Pugh&#8217;s <a href="http://code.google.com/p/checked-uncontended-lock/" rel="nofollow">checked-uncontended-lock</a>.  It allows you to &#8216;assert&#8217; that a lock is uncontended.</p>
<p>Of course just because you don&#8217;t see any contention doesn&#8217;t mean there won&#8217;t be any in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Veentjer</title>
		<link>http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/comment-page-1/#comment-138403</link>
		<dc:creator>Peter Veentjer</dc:creator>
		<pubDate>Tue, 27 Jan 2009 21:52:11 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/#comment-138403</guid>
		<description>In essence all solution are based on one of the 3 following:
- immutability
- isolation (confinement)
- synchronisation

Last year I created a small tool that used bytecode instrumentation to do runtime analysis of concurrent access on objects, just to figure out where to start looking:
http://concurrency-detector.googlecode.com/</description>
		<content:encoded><![CDATA[<p>In essence all solution are based on one of the 3 following:<br />
- immutability<br />
- isolation (confinement)<br />
- synchronisation</p>
<p>Last year I created a small tool that used bytecode instrumentation to do runtime analysis of concurrent access on objects, just to figure out where to start looking:<br />
<a href="http://concurrency-detector.googlecode.com/" rel="nofollow">http://concurrency-detector.googlecode.com/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/comment-page-1/#comment-138393</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 27 Jan 2009 20:43:54 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/#comment-138393</guid>
		<description>Yep, ThreadLocal is a special case of thread confinement and a good way to solve the particular case of Calendar/SimpleDateFormat since they have no state that actually should be shared across threads.</description>
		<content:encoded><![CDATA[<p>Yep, ThreadLocal is a special case of thread confinement and a good way to solve the particular case of Calendar/SimpleDateFormat since they have no state that actually should be shared across threads.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Hall</title>
		<link>http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/comment-page-1/#comment-138390</link>
		<dc:creator>Matthew Hall</dc:creator>
		<pubDate>Tue, 27 Jan 2009 20:25:55 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/#comment-138390</guid>
		<description>Another option is to use a static ThreadLocal so that each thread gets their own instance.

&lt;code&gt;
private static final ThreadLocal calendar =
&#160;&#160;new ThreadLocal() {
&#160;&#160;&#160;&#160;public Calendar initialValue() { return Calendar.getInstance(); } };
public static Calendar getCalendar() { return calendar.get(); }
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Another option is to use a static ThreadLocal so that each thread gets their own instance.</p>
<p><code><br />
private static final ThreadLocal calendar =<br />
&nbsp;&nbsp;new ThreadLocal() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Calendar initialValue() { return Calendar.getInstance(); } };<br />
public static Calendar getCalendar() { return calendar.get(); }<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

