<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>Mohinish&#039;s Blog</title>
	<atom:link href="http://rootedlabs.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rootedlabs.wordpress.com</link>
	<description>Rants from a technologically confused mind !!</description>
	<lastBuildDate>Mon, 19 Dec 2011 22:11:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rootedlabs.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/c6cb91affcea3cc378df48d954c1a2a3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Mohinish&#039;s Blog</title>
		<link>http://rootedlabs.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rootedlabs.wordpress.com/osd.xml" title="Mohinish&#039;s Blog" />
	<atom:link rel='hub' href='http://rootedlabs.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Awesome read: Visual Guide to Nosql Systems</title>
		<link>http://rootedlabs.wordpress.com/2011/12/19/awesome-read-visual-guide-to-nosql-systems/</link>
		<comments>http://rootedlabs.wordpress.com/2011/12/19/awesome-read-visual-guide-to-nosql-systems/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 22:10:26 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/2011/12/19/awesome-read-visual-guide-to-nosql-systems/</guid>
		<description><![CDATA[Visual Guide to NoSQL Systems http://blog.nahurst.com/visual-guide-to-nosql-systems<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=282&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1 id="">Visual Guide to NoSQL Systems</h1>
<p>http://blog.nahurst.com/visual-guide-to-nosql-systems</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/282/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=282&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/12/19/awesome-read-visual-guide-to-nosql-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>A Comparison of java.net.URLConnection and HTTPClient</title>
		<link>http://rootedlabs.wordpress.com/2011/11/30/a-comparison-of-java-net-urlconnection-and-httpclient/</link>
		<comments>http://rootedlabs.wordpress.com/2011/11/30/a-comparison-of-java-net-urlconnection-and-httpclient/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 00:27:08 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=274</guid>
		<description><![CDATA[Good Comparision between above 2: http://www.innovation.ch/java/HTTPClient/urlcon_vs_httpclient.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=274&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Good Comparision between above 2:</p>
<p>http://www.innovation.ch/java/HTTPClient/urlcon_vs_httpclient.html</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/274/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=274&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/11/30/a-comparison-of-java-net-urlconnection-and-httpclient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Progress Listeners for your firefox plugin !!</title>
		<link>http://rootedlabs.wordpress.com/2011/10/13/progress-listeners-for-your-firefox-plugin/</link>
		<comments>http://rootedlabs.wordpress.com/2011/10/13/progress-listeners-for-your-firefox-plugin/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 18:37:24 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=268</guid>
		<description><![CDATA[Following are some sample code snippets and links to make use of to write awesome firefox plugins: Progress Listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events. Progress listeners implement the nsIWebProgressListener interface. https://developer.mozilla.org/en/Code_snippets/Progress_Listeners<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=268&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following are some sample code snippets and links to make use of to write awesome firefox plugins:</p>
<p>Progress Listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events. Progress listeners implement the nsIWebProgressListener interface.</p>
<p>https://developer.mozilla.org/en/Code_snippets/Progress_Listeners</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/268/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=268&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/10/13/progress-listeners-for-your-firefox-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Good Read: Producer Consumer Example</title>
		<link>http://rootedlabs.wordpress.com/2011/09/26/good-read-producer-consumer-example/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/26/good-read-producer-consumer-example/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 22:52:52 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=260</guid>
		<description><![CDATA[Reference: http://www.cin.ufpe.br/~java/docs/tutorial/essential/threads/synchronization.html Gives an example of Producer Consumer using java threads and synchronization and then via lock from the concurrency package<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=260&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Reference:</p>
<p>http://www.cin.ufpe.br/~java/docs/tutorial/essential/threads/synchronization.html</p>
<p>Gives an example of Producer Consumer using java threads and synchronization and then via lock from the concurrency package</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=260&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/26/good-read-producer-consumer-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Good Read: Non Blocking Algorithm, Non Blocking Stack / LinkedQueue</title>
		<link>http://rootedlabs.wordpress.com/2011/09/26/good-read-non-blocking-algorithm-non-blocking-stack-linkedqueue/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/26/good-read-non-blocking-algorithm-non-blocking-stack-linkedqueue/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 04:25:14 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=253</guid>
		<description><![CDATA[Java theory and practice: Introduction to nonblocking algorithms Reference: http://www.ibm.com/developerworks/java/library/j-jtp04186/index.html public class ConcurrentStack { AtomicReference&#60;Node&#62; head = new AtomicReference&#60;Node&#62;(); public void push(E item) { Node newHead = new Node(item); Node oldHead; do { oldHead = head.get(); newHead.next = oldHead; } while (!head.compareAndSet(oldHead, newHead)); } public E pop() { Node oldHead; Node newHead; do { oldHead [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=253&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Java theory and practice: Introduction to nonblocking algorithms<br />
Reference: http://www.ibm.com/developerworks/java/library/j-jtp04186/index.html</p>
<div align="">
<code><br />
public class ConcurrentStack {<br />
    AtomicReference&lt;Node&gt; head = new AtomicReference&lt;Node&gt;();</p>
<p>    public void push(E item) {<br />
        Node newHead = new Node(item);<br />
        Node oldHead;<br />
        do {<br />
            oldHead = head.get();<br />
            newHead.next = oldHead;<br />
        } while (!head.compareAndSet(oldHead, newHead));<br />
    }</p>
<p>    public E pop() {<br />
        Node oldHead;<br />
        Node newHead;<br />
        do {<br />
            oldHead = head.get();<br />
            if (oldHead == null)<br />
                return null;<br />
            newHead = oldHead.next;<br />
        } while (!head.compareAndSet(oldHead,newHead));<br />
        return oldHead.item;<br />
    }</p>
<p>    static class Node {<br />
        final E item;<br />
        Node next;</p>
<p>        public Node(E item) { this.item = item; }<br />
    }<br />
}</p>
<p></code>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/253/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=253&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/26/good-read-non-blocking-algorithm-non-blocking-stack-linkedqueue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Good Read: Immutable and Defensive Copies</title>
		<link>http://rootedlabs.wordpress.com/2011/09/26/good-read-immutable-and-defensive-copies/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/26/good-read-immutable-and-defensive-copies/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 03:42:40 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=246</guid>
		<description><![CDATA[Been reading java concurrency blog @ www.vogella.de Ref: http://www.vogella.de/articles/JavaConcurrency/article.html#memorymodel_atomic 1. Immutability The simplest way to avoid problems with concurrency is to share only immutable data between threads. Immutable data is data which can not changed. To make a class immutable make - all its fields final - the class declared as final - the this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=246&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Been reading java concurrency blog @ www.vogella.de<br />
Ref: http://www.vogella.de/articles/JavaConcurrency/article.html#memorymodel_atomic</p>
<p>1. Immutability</p>
<p>The simplest way to avoid problems with concurrency is to share only immutable data between threads. Immutable data is data which can not changed.</p>
<p>To make a class immutable make</p>
<p>- all its fields final<br />
- the class declared as final<br />
- the this reference is not allowed to escape during construction</p>
<p>Any fields which refer to mutable data objects are</p>
<p>- private<br />
- have no setter method<br />
- they are never directly returned of otherwise exposed to a caller<br />
- if they are changed internally in the class this change is not visible and has no effect outside of the class</p>
<p>An immutable class may have some mutable data which is uses to manages its state but from the outside this class nor any attribute of this classes can get changed.</p>
<p>For all mutable fields, e.g. Arrays, that are passed from the outside to the class during the construction phase, the class needs to make a defensive-copy of the elements to make sure that no other object from the outside still can change the data</p>
<p>2. Defensive Copies</p>
<p>You must protected your classes from calling code. Assume that calling code will do its best to change your data in a way you didn&#8217;t expect it. While this is especially true in case of immutable data it is also true for non-immutable data which you still not expect that this data is changed outside your class.</p>
<p>To protect your class against that you should copy data you receive and only return copies of data to calling code.</p>
<p>The following example creates a copy of a list (ArrayList) and returns only the copy of the list. This way the client of this class cannot remove elements from the list.</p>
<p><strong><br />
<code><br />
package de.vogella.performance.defensivecopy;</p>
<p>import java.util.ArrayList;<br />
import java.util.Collections;<br />
import java.util.List;</p>
<p>public class MyDataStructure {<br />
	List list = new ArrayList();</p>
<p>	public void add(String s) {<br />
		list.add(s);<br />
	}</p>
<p>/**<br />
	 * Makes a defensive copy of the List and return it<br />
	 * This way cannot modify the list itself<br />
	 *<br />
	 * @return List<br />
	 */</p>
<p>	public List getList() {<br />
		return Collections.unmodifiableList(list);<br />
	}<br />
}<br />
</code><br />
</strong>			</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=246&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/26/good-read-immutable-and-defensive-copies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Atomic Operations</title>
		<link>http://rootedlabs.wordpress.com/2011/09/26/atomic-operations/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/26/atomic-operations/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 03:28:00 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=244</guid>
		<description><![CDATA[Java 1.5 added capability to define atomic variables, e.g AtomicInteger. The word &#8216;automic&#8217; comes from the concept of Atomic Operations which is a process that is computed as a single unit of work without any interference. For example, reading and writing a value to a int variable is automic, the value of variable doesnt change [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=244&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Java 1.5 added capability to define atomic variables,  e.g AtomicInteger. The word &#8216;automic&#8217; comes from the concept of Atomic Operations which is a process that is computed as a single unit of work without any interference. </p>
<p>For example, reading and writing a value to a int variable is automic, the value of variable doesnt change during this process, however the operation i++ is not since it involves first reading the value from i and then incrementing it, however the value i may change due to some other thread during the process.</p>
<p>Automic varibles like AutomicInteger maintains this automic feature by providing methods like getAndDecrement(), getAndSet() etc which prevents any other thread to modify the value while executing these methods.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=244&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/26/atomic-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Awesome Blog: HBase, Garbage Collection</title>
		<link>http://rootedlabs.wordpress.com/2011/09/13/awesome-blog-hbase-garbage-collection/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/13/awesome-blog-hbase-garbage-collection/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 06:07:25 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=239</guid>
		<description><![CDATA[Good Read http://www.cloudera.com/blog/2011/02/avoiding-full-gcs-in-hbase-with-memstore-local-allocation-buffers-part-1/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=239&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Good Read</p>
<p>http://www.cloudera.com/blog/2011/02/avoiding-full-gcs-in-hbase-with-memstore-local-allocation-buffers-part-1/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=239&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/13/awesome-blog-hbase-garbage-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Some Good Sites on AVL Trees</title>
		<link>http://rootedlabs.wordpress.com/2011/09/03/some-good-sites-on-avl-trees/</link>
		<comments>http://rootedlabs.wordpress.com/2011/09/03/some-good-sites-on-avl-trees/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 01:32:10 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=235</guid>
		<description><![CDATA[http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx http://www.cs.jhu.edu/~goodrich/dsa/trees/avltree.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=235&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx</p>
<p>http://www.cs.jhu.edu/~goodrich/dsa/trees/avltree.html</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/235/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=235&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/09/03/some-good-sites-on-avl-trees/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
		<item>
		<title>Awesome resume building and Interview tips</title>
		<link>http://rootedlabs.wordpress.com/2011/06/13/awesome-resume-building-and-interview-tips/</link>
		<comments>http://rootedlabs.wordpress.com/2011/06/13/awesome-resume-building-and-interview-tips/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 18:17:26 +0000</pubDate>
		<dc:creator>rootedlabs</dc:creator>
				<category><![CDATA[Technology / Startups]]></category>

		<guid isPermaLink="false">http://rootedlabs.wordpress.com/?p=231</guid>
		<description><![CDATA[Found a good read on awesome resume writing and interviewing tips: http://paultyma.blogspot.com/2007/03/howto-pass-silicon-valley-software.html http://steve-yegge.blogspot.com/2007/09/ten-tips-for-slightly-less-awful-resume.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=231&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Found a good read on awesome resume writing and interviewing tips:</p>
<p>http://paultyma.blogspot.com/2007/03/howto-pass-silicon-valley-software.html</p>
<p>http://steve-yegge.blogspot.com/2007/09/ten-tips-for-slightly-less-awful-resume.html</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rootedlabs.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rootedlabs.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rootedlabs.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rootedlabs.wordpress.com&amp;blog=8847477&amp;post=231&amp;subd=rootedlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rootedlabs.wordpress.com/2011/06/13/awesome-resume-building-and-interview-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62ceb8929c87fd07f521c5721ebee221?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rootedlabs</media:title>
		</media:content>
	</item>
	</channel>
</rss>
