<?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>Java Architect</title>
	<atom:link href="http://nikhilb020875.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nikhilb020875.wordpress.com</link>
	<description>Just another Wordpress.com weblog</description>
	<lastBuildDate>Sat, 30 Apr 2011 15:34:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nikhilb020875.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Java Architect</title>
		<link>http://nikhilb020875.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nikhilb020875.wordpress.com/osd.xml" title="Java Architect" />
	<atom:link rel='hub' href='http://nikhilb020875.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Cache vs Pool</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/24/cache-vs-pool/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/24/cache-vs-pool/#comments</comments>
		<pubDate>Wed, 24 May 2006 07:14:48 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[Caching]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Pooling]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/24/cache-vs-pool/</guid>
		<description><![CDATA[Both caches and pools are used in J2EE environment. A pool is a collection of stateless objects. Eample &#8211; database connection pools, thread pools, and Servlet pools. A cache is a collection of stateful objects. Example &#8211; Entity Bean caches and Stateful Session Bean caches. Aside from Entity Beans and Stateful Session Beans, caches are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=10&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Both caches and pools are used in J2EE environment.</p>
<p>A <i>pool</i> is a collection of <i>stateless</i> objects. Eample &#8211; database connection pools, thread pools, and Servlet pools.</p>
<p>A <i>cache</i> is a collection of <i>stateful</i> objects. Example &#8211; Entity Bean caches and Stateful Session Bean caches. Aside from Entity Beans and Stateful Session Beans, caches are useful to hold any data that you want to look up once and reference it multiple times, things like JNDI entries, RMI services, configuration file contents, etc. Caches save time!</p>
<p>The main distinction between a cache and a pool is what is contained in them. In other words: when you retrieve an object from a cache or a pool, do you need a specific object, or will any object do? If you need a specific object, then each object maintains state; hence, you need to use a cache. If, on the other hand, you can use <i>any</i> object, then the objects do not maintain state and you can use a pool.</p>
<p>Let&#8217;s compare their performance considerations:</p>
<ul>
<li>A request for a pooled object can be serviced by any object in the pool.</li>
<li>A request for a cached object can only be serviced by a specific object in the cache.</li>
<li>If all objects in a pool are in use when a request is made, then the request must wait for any object to be returned to the pool before the request can be satisfied.</li>
<li>If the requested object in a cache is in use when it is requested, then the request must wait. It doesn&#8217;t matter if the rest of objects in the cache are available, as a specific one is needed.</li>
<li>The size of a pool can be fixed or can grow. If a new object is requested from an empty pool, a new object can be created and added to the pool.</li>
<li>The size of a cache is usually fixed (because it holds specific objects and creating a new one is not always an option). However, if the cache is full and a new object needs to be loaded into the cache, an existing object has to be removed from the cache (activation and passivation).</li>
</ul>
<p>Full Article is at: <a href="http://www.informit.com/guides/content.asp?g=java&amp;seqNum=104&amp;rl=1">http://www.informit.com/guides/content.asp?g=java&amp;seqNum=104&amp;rl=1</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=10&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/24/cache-vs-pool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>Why ORM tools are not recommended</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/19/why-orm-tools-are-not-recommended/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/19/why-orm-tools-are-not-recommended/#comments</comments>
		<pubDate>Fri, 19 May 2006 12:46:27 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/19/why-orm-tools-are-not-recommended/</guid>
		<description><![CDATA[I am posting this at the risk of sounding anti-ORM. But this is the result of my study of different persistence strategies, and I&#8217;d be happy to be proved wrong. Distribution Readiness Due to the stateful nature of the ORM Persistence Manager Object, the code is not cluster ready. Lets take the example of “session” [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=9&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">I am posting this at the risk of sounding anti-ORM. But this is the result of my study of different persistence strategies, and I&#8217;d be happy to be proved wrong.</p>
<p class="MsoNormal">
<ol>
<li class="MsoNormal"><b>Distribution Readiness </b></li>
</ol>
<p class="MsoNormal">Due to the stateful nature of the ORM Persistence Manager Object, the code is not cluster ready.</p>
<p class="MsoNormal">Lets take the example of “session” object (Hibernate Session Manager) in hibernate.</p>
<p class="MsoNormal">We have two business classes MyClass and SomeOtherClass:</p>
<p class="MsoNormal">
<p class="MsoNormal">public class MyClass {</p>
<p class="MsoNormal">   public static void myMethod(String[] args) throws java.text.ParseException {</p>
<p class="MsoNormal">          Session s1 = HibernateUtil.currentSession();</p>
<p class="MsoNormal">          Transaction t1 = s1.beginTransaction();</p>
<p class="MsoNormal">
<p class="MsoNormal">          UserMaster user1 = (UserMaster) s1.load(UserMaster.class, &#8220;UserName22458&#8243;);</p>
<p class="MsoNormal">          user1.setFname(&#8220;FName s1&#8243;);</p>
<p class="MsoNormal">          SomeOtherClass someOtherClass = new SomeOtherClass();</p>
<p class="MsoNormal">          someOtherClass.dosomething(user1);</p>
<p class="MsoNormal">
<p class="MsoNormal">          t1.commit();</p>
<p class="MsoNormal">   }</p>
<p class="MsoNormal">}</p>
<p class="MsoNormal">
<p class="MsoNormal">public class SomeOtherClass {</p>
<p class="MsoNormal">   public void dosomething(UserMaster user){</p>
<p class="MsoNormal">          Session s = HibernateUtil.currentSession();</p>
<p class="MsoNormal">          UserMaster user2 = (UserMaster) s.load(UserMaster.class, &#8220;UserName22458&#8243;);</p>
<p class="MsoNormal">          System.out.println(&#8220;compare same row in copied sessions. user==user2 -&gt; &#8221; + (user==user2));</p>
<p class="MsoNormal">   }</p>
<p class="MsoNormal">
<p class="MsoNormal">}</p>
<p class="MsoNormal">
<p class="MsoNormal">This code would give different results if MyClass and SomeOtherClass are put on the different nodes while clustering.</p>
<p class="MsoNormal">What I mean to say is that the code is not cluster ready as session is stateful. </p>
<p class="MsoNormal">
<ol>
<li class="MsoNormal"><b>One of the main disadvantages that I      see with ORM tools is that the usage of the Cache is forced on us:</b></li>
</ol>
<p class="MsoNormal">ORM tools heavily depend on object caches. In an ORM tool object caches are used to:</p>
<p class="MsoNormal">    a. Ensure that objects are unique within memory and</p>
<p class="MsoNormal">    b. Improve application performance</p>
<p class="MsoNormal">
<p class="MsoNormal">The primary reason caches are universal in ORM tools is to ensure that objects are unique within memory and that has nothing to do with the primary reason why the caches should be used in the first place. A data cache is useful only when we have data that is accessed frequently but is rarely changed. That’s the only case when an application can benefit by the usage of a cache and this situation is not true for all applications.</p>
<p class="MsoNormal">The problem becomes more apparent when we try to use ORM tools in clustered environments or if there is another application accessing the database which does not goes through the same cache.</p>
<p class="MsoNormal">In clustered environments we’d have to live with the disadvantages associated with data cache synchronization. It does not make sense if I am not getting any benefit out of cache.</p>
<p class="MsoNormal">
<p class="MsoNormal">Am I right in saying that ORM tools should only be used for:</p>
<p class="MsoNormal">    a. Applications that will not use clustering for scaling.</p>
<p class="MsoNormal">    b. Applications that have data that is accessed frequently but is rarely changed so that the overheads of cache synchronization are justified.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal">Other disadvantages:</p>
<ol>
<li class="MsoNormal"><b>Less Control on SQL Queries</b></li>
<li class="MsoNormal"><b>Data and behavior are not separated</b></li>
<li class="MsoNormal"><b>Façade needs to be built if the data      model is to be made available in a distributed architecture</b></li>
<li class="MsoNormal"><b>Each ORM technology/product has a      different set of APIs and porting code between them is not easy</b></li>
</ol>
<p class="MsoNormal">
<p class="MsoNormal">Points 2, 3 and 4 can be overcome by using DAO layer to hide the ORM tool. But that would also mean that the DAO layer does not exposes the same set of persistent objects that the ORM layer works on. This would have two disadvantages:</p>
<p class="MsoNormal">    a. Persistent objects have to be translated back and forth to the objects exposed by the DAO layer.</p>
<p class="MsoNormal">    b. The fact that ORM layer does not works on the domain objects directly, seems to take a certain edge out of ORM solution. After all, one of the benefits of an ORM solution is that a complicated domain model with all its relationships can be made persistent.</p>
<p class="MsoNormal">
<p class="MsoNormal">Nikhil Bajpai (<a href="http://www.geocities.com/nikhilb020875/">http://www.geocities.com/nikhilb020875/</a>)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=9&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/19/why-orm-tools-are-not-recommended/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>Connections and Threads</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/16/connections-and-threads/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/16/connections-and-threads/#comments</comments>
		<pubDate>Tue, 16 May 2006 11:05:43 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[connection]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/16/connections-and-threads/</guid>
		<description><![CDATA[Question: which is the best way to manage JDBC Connections? Issues: Passing connection around as a parameter is a nuisance. (A Bigger point of contention is &#39;global variables&#39; vs. &#39;passing parameters&#39; style of coding. To some, the &#39;global variables&#39; approach seamless object orientated) I want to ensure that within the session I use the same [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=7&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Question: which is the best way to manage JDBC Connections?</p>
<p>Issues:</p>
<ol>
<li class="MsoNormal">Passing connection around as      a parameter is a nuisance. (A Bigger point of contention is &#39;global      variables&#39; vs. &#39;passing parameters&#39; style of coding. To some, the &#39;global      variables&#39; approach seamless object orientated)</li>
<li class="MsoNormal">I want to ensure that within the      session I use the same connection object across requests.</li>
</ol>
<p>Solution:</p>
<p>Point number one is best solved by using ThreadLocal.</p>
<p>Point number two can only be solved by saving the connection in HttpSession. That&rsquo;s again is a source of contention. Reason being:</p>
<p><!--[if !supportLists]-->1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->You end up needing a database connection (and an active transaction) per concurrent *user* of your application (i.e. everyone who is logged on and has an active session) instead of a database connection per current *request*.</p>
<p><!--[if !supportLists]-->2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->The database connection would remain unavailable to other users</p>
<p><!--[if !supportLists]-->3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->Other users have to wait to access rows are in the middle of updating, and the transaction has locked</p>
<p><!--[if !supportLists]-->4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->What if there are multiple requests for the same session?&nbsp; This can happen more often than you might think. In any such scenario, it is not safe to assume that a Connection retrieved from a session is only being used by a single thread.&nbsp; You&#39;ll need to ensure that you don&#39;t try to retrieve it from more than one thread simultaneously. A couple of common causes:</p>
<p><!--[if !supportLists]-->a.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->Framed presentation, because the browser will often trigger multiple simultaneous requests, and they are all participating in the same session.</p>
<p><!--[if !supportLists]-->b.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--[endif]-->User submits a request that starts a long SQL query, presses STOP, and then submits a second request while the first one is still running.</p>
<p>Nevertheless there are situations where the transaction spans across request.</p>
<p>Let&rsquo;s discuss the merits of using ThreadLocal:</p>
<p>This is what I got from one of the mailing lists: (<a href="http://marc2.theaimsgroup.com/?l=tomcat-user&amp;m=103609047904032&amp;w=2" title="http://marc2.theaimsgroup.com">http://marc2.theaimsgroup.com/?l=tomcat-user&amp;m=103609047904032&amp;w=2</a>)<br />
The notion of binding a Connection to a particular Thread using a ThreadLocal is a pretty good idea. The big advantage to my mind is that you can use the Connection from any level of the call tree without passing it around as a parameter. What you need to keep in mind is that you must reset the ThreadLocal before the Thread leaves your control. In other words:</p>
<ul>
<li class="MsoNormal">At the beginning of your      processing, check out a Connection from a connection pool and bind it to      the ThreadLocal.</li>
<li class="MsoNormal">Throughout processing, the      ThreadLocal can be used to obtain access to the Connection.</li>
<li class="MsoNormal">At the end of your      processing, close the connection (which returns it to the connection pool)      and reset the ThreadLocal.</li>
</ul>
<p>If you need to maintain database state across multiple HTTP requests, a slight modification is needed: before you check a Connection out from the connection pool, look in the HttpSession to see whether there is a Connection there already. If there is, bind that Connection to the ThreadLocal. Otherwise, obtain a new Connection and put it both in the HttpSession and in the ThreadLocal.</p>
<p>In the context of servlets, one good way to structure this would be to create a ServletWithConnection class (extending HttpServlet), and have its service() method look something like this:</p>
<p><i>protected static ThreadLocal tl = new ThreadLocal();</i></p>
<p><i>protected void service (&#8230;&#8230;) {</i></p>
<p><i>Connection conn = connPool.getConnection();</i></p>
<p><i>tl.set(conn);</i></p>
<p><i>super.service();</i></p>
<p><i>tl.set(null);</i></p>
<p><i>conn.close();</i></p>
<p><i>}</i></p>
<p>Then you can extend this servlet whenever you need a database connection, override doGet, doPost, whatever, as normal, and access the Connection via tl.get() whenever you need it.</p>
<p>Incidentally, Martin Fowler talks about this in his new book on enterprise architecture patterns &#8212; look at the &quot;registry&quot; pattern.</p>
<p>The following are the points against threadlocal approach:</p>
<ol>
<li class="MsoNormal">If you&#39;re going to keep a      Connection in the session (across requests) at all, you&#39;re wasting your      time bothering with a connection pool &#8212; you&rsquo;ve already said you&#39;re      willing to leave an expensive resource (an open connection to the      database) allocated to a particular user in between requests, even if the      user went to lunch. You might as well just open a connection when the      session is created, and close it when the session completes.</li>
<li class="MsoNormal">The pattern mentioned above      (extending HttpServlet) does not violates these principles (because it      gives the connection back before the request is completed), but it does do      unnecessary work if you&#39;re running on a servlet container that provides      data sources via JNDI resources &#8212; and that means every J2EE appserver in      the world, plus Tomcat 4.x and 5.x, and I&#39;m sure a bunch of others.</li>
<li class="MsoNormal">It&rsquo;s overkill if many calls      don&#39;t need to use the database for anything. I guess you could be lazy and      only get the connection from the pool and bind it to the threadlocal just      before you use it for the first time.</li>
<li class="MsoNormal">You&#39;d still need to go      straight to the connection pool, if you needed to use a second connection      in the same thread (e.g. for logging. you still want to log even if there      is a rollback).</li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=7&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/16/connections-and-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>How DriverManager finds the correct driver</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/09/how-drivermanager-finds-the-correct-driver/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/09/how-drivermanager-finds-the-correct-driver/#comments</comments>
		<pubDate>Tue, 09 May 2006 06:09:32 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/09/how-drivermanager-finds-the-correct-driver/</guid>
		<description><![CDATA[In JDBC, the way to get connection to a database is: Class.forName(&#34;&#60;name of driver&#62;&#34;); DriverManager.getConnection(&#34;url&#34;) ; Lets analyse these two lines. The first line class.forName(), simply finds that class from the class path and loads it. I mean, nothing stops you from loading the driver class by including it in the import statements. The code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=5&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In JDBC, the way to get connection to a database is:</p>
<p>Class.forName(&quot;&lt;name of driver&gt;&quot;);</p>
<p>DriverManager.getConnection(&quot;url&quot;) ;</p>
<p>Lets analyse these two lines.</p>
<p>The first line class.forName(), simply finds that class from the class path and loads it.<br />
I mean, nothing stops you from loading the driver class by including it in the import statements. The code will work fine. But we dont put it in the import statements as we want to keep the flexibility of changing the driver withing recompiling our code.<br />
There is something more. The driver classes have a static block that run as soon as the class is loaded.<br />
The static block registers that driver with the driverManager against a perticular subprotocol. For example a driver called com.test.XYZDriver might register itself against the subprotocol &quot;XYZ&quot;</p>
<p>Now about the second statement: Drivemanager.getConnection(&quot;url&quot;);</p>
<p>A database URL (or JDBC URL) is a platform independent way of adressing a database. A database/JDBC URL is of the form jdbc:[subprotocol]:[node]/[databaseName]</p>
<p>When the static method &quot;getConnection(url)&quot; is executed, DriverManager extracts the subprotocol from the url and finds the driver registered against that subprotocal. For a url &quot;jdbc:XYZ:192.168.23.34/myDB&quot;, the driverManager will try to find the driver registered against the subprotocol &quot;XYZ&quot;. The driver is expected to know how to make sence of the rest of the protocol and get the connection. The driverManager returns that connection.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=5&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/09/how-drivermanager-finds-the-correct-driver/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>J2EE patterns: Business Delegate</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/09/j2ee-patterns-business-delegate/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/09/j2ee-patterns-business-delegate/#comments</comments>
		<pubDate>Tue, 09 May 2006 05:23:50 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[J2EE patterns]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/09/j2ee-patterns-business-delegate/</guid>
		<description><![CDATA[here is what i found from one of the mailing lists: Business Delegate is used to reduce the coupling between clients (usually presentation layer components) and the business services (especially distributed business components). Most importantly you will need business delegate when you want to hide the complexity of accessing the business services (lookup..etc) and you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=4&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>here is what i found from one of the mailing lists:</p>
<p>Business Delegate is used to reduce the coupling between clients (usually presentation layer components) and the business services (especially distributed business components). Most importantly you will need business delegate when you want to hide the complexity of accessing the business services (lookup..etc) and you may eventually incorporate client-side caching, and you can convert the low-level exceptions (RemoteException, Look up exceptions) into application level exceptions which are more meaningful to the client. In a way, you can assume Business Delegate is a client side Session Facade.</p>
<p>Think of Business Delegate when :</p>
<ul>
<li>presentation tier components interact directly with business services (usually distributed)</li>
<li>It is desirable to minimize coupling between presentation-tier clients and the business service, thus hiding the underlying implementation details of the service, such as lookup and access.</li>
<li>When you want to implement caching mechanisms for business service information</li>
<li>When it is desirable to reduce the traffic between client and business services.</li>
<li>When you want to shield the clients from possible volatility in the implementation of business service API</li>
<li>When you want to implement re-try mechanisms (some times service may not be accessible in one go, in this case , before letting client know about this, you can keep the logic of re-trying here..)</li>
<li>When you need to hide remoteness (Location transparency from client perspecive)</li>
</ul>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=4&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/09/j2ee-patterns-business-delegate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>SCEA</title>
		<link>http://nikhilb020875.wordpress.com/2006/05/09/scea/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/05/09/scea/#comments</comments>
		<pubDate>Tue, 09 May 2006 05:23:15 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://nikhilb020875.wordpress.com/2006/05/09/scea/</guid>
		<description><![CDATA[I created this blog to write about by progress in preperation for SCEA examination. Apart from that, I&#8217;d be puting anything that is of interest to me as an architect.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=3&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I created this blog to write about by progress in preperation for SCEA examination.</p>
<p>Apart from that, I&#8217;d be puting anything that is of interest to me as an architect.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=3&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/05/09/scea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://nikhilb020875.wordpress.com/2006/04/19/hello-world/</link>
		<comments>http://nikhilb020875.wordpress.com/2006/04/19/hello-world/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 09:25:55 +0000</pubDate>
		<dc:creator>nikhilb020875</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=1&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/nikhilb020875.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/nikhilb020875.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nikhilb020875.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nikhilb020875.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nikhilb020875.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nikhilb020875.wordpress.com&amp;blog=192733&amp;post=1&amp;subd=nikhilb020875&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nikhilb020875.wordpress.com/2006/04/19/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc62d683d53ba85ccd1e123af439af2f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nikhilb020875</media:title>
		</media:content>
	</item>
	</channel>
</rss>
