<?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/"
	>

<channel>
	<title>ClickOnChris &#187; Java</title>
	<atom:link href="http://www.clickonchris.com/category/programming/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clickonchris.com</link>
	<description>Christopher G Johnson: programmer, entrepreneur, gamer</description>
	<lastBuildDate>Sat, 21 Jan 2012 23:31:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Reducing JBoss&#8217;s Memory Footprint</title>
		<link>http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/</link>
		<comments>http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 17:58:41 +0000</pubDate>
		<dc:creator>clickonchris</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://www.clickonchris.com/?p=323</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I am working on a project to convert a handful of J2EE applications from an Oracle OC4J application (no longer supported) server to JBoss 5.1.0.  Among the many challenges in the conversion is the fact that JBoss&#8217;s default profile has a significantly larger memory footprint than OC4J.  In the past I have just accepted that <strong>Jboss uses over 400MB of heap space before you even deploy anything.</strong> This time however we were hoping to reuse the same hardware from the old application server with the new application server.  When the test system started paging and eventually using up all of the physical memory available, we were forced to choose between ordering more memory and trying to tune jboss to reduce the memory footprint.</p>
<p>We ended up having a lot of success reducing the footprint through tuning.  <strong>Bottom line: we reduced the memory footprint by 120MB, and the startup time from 53s to 24s</strong></p>
<p>Here were the steps taken</p>
<table border="0" width="550">
<tbody>
<tr>
<td width="189" valign="bottom"></td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom"><strong>Heap Size (MB)</strong></td>
<td width="64" valign="bottom"><strong>Used (MB)</strong></td>
<td width="101" valign="bottom"><strong>Reduction in Used (MB)</strong></td>
</tr>
<tr>
<td width="189" valign="bottom"><strong>Starting Heap</strong></td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom"><strong>419</strong></td>
<td width="64" valign="bottom"><strong>314</strong></td>
<td width="101" valign="bottom"></td>
</tr>
<tr>
<td width="189" valign="bottom"><span style="color: #800000;">commented out debug level MBeans annotation in deployers.xml</span></td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom"><span style="color: #800000;">322</span></td>
<td width="64" valign="bottom"><span style="color: #800000;">247</span></td>
<td width="101" valign="bottom"><strong><span style="color: #800000;">67</span></strong></td>
</tr>
<tr>
<td width="189" valign="bottom">removed ejb3 services</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">317</td>
<td width="64" valign="bottom">238</td>
<td width="101" valign="bottom">9</td>
</tr>
<tr>
<td width="189" valign="bottom">removed messaging folder &amp; props</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">310</td>
<td width="64" valign="bottom">238</td>
<td width="101" valign="bottom">0</td>
</tr>
<tr>
<td width="189" valign="bottom"><span style="color: #800000;">removed seam &amp; admin-console</span></td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom"><span style="color: #800000;">256</span></td>
<td width="64" valign="bottom"><span style="color: #800000;">205</span></td>
<td width="101" valign="bottom"><span style="color: #800000;"><strong>33</strong></span></td>
</tr>
<tr>
<td width="189" valign="bottom">Removed xnio-deployer and xnio-provider</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">256</td>
<td width="64" valign="bottom">203</td>
<td width="101" valign="bottom">2</td>
</tr>
<tr>
<td width="189" valign="bottom">removed ROOT.war</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">256</td>
<td width="64" valign="bottom">203</td>
<td width="101" valign="bottom">0</td>
</tr>
<tr>
<td width="189" valign="bottom">removed management</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">256</td>
<td width="64" valign="bottom">199</td>
<td width="101" valign="bottom">4</td>
</tr>
<tr>
<td width="189" valign="bottom">removed jbossws.sar</td>
<td width="64" valign="bottom"></td>
<td width="113" valign="bottom">256</td>
<td width="64" valign="bottom">193</td>
<td width="101" valign="bottom">6</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>The instructions for each step can be found : <a href="http://community.jboss.org/wiki/JBoss5xTuningSlimming">http://community.jboss.org/wiki/JBoss5xTuningSlimming</a></p>
<p>Notes on my environment and testing process:</p>
<ul>
<li>Windows XP, JDK 1.6.0_22,</li>
<li>JBoss 5.1.0.GA.  Xmx=512M , Xmx=256 (this is why heap didn&#8217;t drop below 256)</li>
<li>I used jvisualvm to watch the heap and &#8220;used&#8221; memory values</li>
<li>For the &#8220;Used&#8221; memory, I took the maximum observed value while JBoss was starting.  If you understand that a time vs. memory usage graph follows a sawtooth pattern as objects are instantiated and garbage collected, then I took the value from the tip of the highest tooth.</li>
</ul>
<g:plusone href="http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/"></g:plusone><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/&text=Reducing+JBoss%E2%80%99s+Memory+Footprint&via=clickonchris&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.clickonchris.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter6.png" alt="Post to Twitter" /></a></p></div><div align="left" style="vertical-align:top;display:inline-block; padding:2px 10px 10px 35px;"><a name="fb_share" type="button" share_url="http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.clickonchris.com/2011/06/tuning-reducing-jboss-memory-footprint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Fluff Just Stuff 2011, Madison, WI</title>
		<link>http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/</link>
		<comments>http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 19:54:02 +0000</pubDate>
		<dc:creator>clickonchris</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.clickonchris.com/?p=303</guid>
		<description><![CDATA[I attended the No Fluff Just Stuff conference in Madison, WI this weekend. It was a great chance to learn the newest Java trends and share struggles in programming with people much like myself, even if most of them were cheeseheads. Here are some of my reflections on the state of Java tech post-conference: -Java [...]]]></description>
			<content:encoded><![CDATA[<p>I attended the <a href="http://www.nofluffjuststuff.com/">No Fluff Just Stuff</a> conference in Madison, WI this weekend.  It was a great chance to learn the newest Java trends and share struggles in programming with people much like myself, even if most of them were cheeseheads.  Here are some of my reflections on the state of Java tech post-conference:</p>
<p>-Java 7 is underwhelming, mostly because it will not have closures.  It will however introduce enhancements to speed up Groovy, JRuby, and Scala</p>
<p>-If I read between the lines what features are in HTML and any of them are supported by Chrome, then I think that HTML5+Chrome could easily turn into a gaming platform!</p>
<p>-There is no question that Groovy is the &#8220;next big thing&#8221; for Java.  Get on board.</p>
<p>-A java developer could easily add Hadoop to his resume (and dollars to his pocket), by learning Hadoop with <a href="http://www.cascading.org/">Cascading</a>.  Hadoop-worthy scale data sets are available for free from amazon: <a href="http://aws.amazon.com/publicdatasets/">http://aws.amazon.com/publicdatasets/</a></p>
<p>Grails is really cool.  I wish there was a hosting platform available that was anything close to Heroku for Rails.  I think it is unlikely that we will hear any good Startup stories with Grails for that reason.</p>
<g:plusone href="http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/"></g:plusone><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/&text=No+Fluff+Just+Stuff+2011%2C+Madison%2C+WI&via=clickonchris&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.clickonchris.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter6.png" alt="Post to Twitter" /></a></p></div><div align="left" style="vertical-align:top;display:inline-block; padding:2px 10px 10px 35px;"><a name="fb_share" type="button" share_url="http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.clickonchris.com/2011/02/no-fluff-just-stuff-2011-madison-wi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the Default Version of Java in Windows</title>
		<link>http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/</link>
		<comments>http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 14:32:54 +0000</pubDate>
		<dc:creator>clickonchris</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.clickonchris.com/?p=232</guid>
		<description><![CDATA[You&#8217;re a java programmer on a Windows development environment.  You fire up the command prompt and run &#8220;java -version&#8221;.  It&#8217;s some JRE and its not even the version you want!  Eclipse is throwing a fit.  There&#8217;s no good way to figure out what path the &#8220;java.exe&#8221; you are executing lives in. The most surefire way [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re a java programmer on a Windows development environment.  You fire up the command prompt and run &#8220;java -version&#8221;.  It&#8217;s some JRE and its not even the version you want!  Eclipse is throwing a fit.  There&#8217;s no good way to figure out what path the &#8220;java.exe&#8221; you are executing lives in.</p>
<p>The most surefire way to solve this problem is take the java bin path (ex: C:\program files\Java\jdk1.6.0_07\bin)  you want and prepend it to your System level PATH environment variable, as highlighted below.  This will ensure that you are executing the java.exe from the expected java installation every time.<br />
<a href="http://www.clickonchris.com/wp-content/uploads/2010/10/java-version.jpg"><img class="alignleft size-full wp-image-233" title="Windows Environment Variables" src="http://www.clickonchris.com/wp-content/uploads/2010/10/java-version.jpg" alt="" width="394" height="436" /></a></p>
<g:plusone href="http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/"></g:plusone><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/&text=Setting+the+Default+Version+of+Java+in+Windows&via=clickonchris&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.clickonchris.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter6.png" alt="Post to Twitter" /></a></p></div><div align="left" style="vertical-align:top;display:inline-block; padding:2px 10px 10px 35px;"><a name="fb_share" type="button" share_url="http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.clickonchris.com/2010/10/setting-the-default-version-of-java-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JPA Annotation Cheatsheet</title>
		<link>http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/</link>
		<comments>http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 13:51:28 +0000</pubDate>
		<dc:creator>clickonchris</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.clickonchris.com/?p=214</guid>
		<description><![CDATA[Whenever I need need help configuring JPA annotations I turn to google, and I always find it difficult to find a good cheatsheet. Well here is my favorite JPA annotation cheatsheet.  Even though it says Oracle and Toplink it applies to any Spring/JPA/Hibernate technology stack: http://www.oracle.com/technetwork/middleware/ias/toplink-jpa-annotations-096251.html Oh yeah, and here&#8217;s my tip on using cascades: [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I need need help configuring JPA annotations I turn to google, and I always find it difficult to find a good cheatsheet.</p>
<p>Well here is my favorite JPA annotation cheatsheet.  Even though it says Oracle and Toplink it applies to any Spring/JPA/Hibernate technology stack:</p>
<p><a href="http://www.oracle.com/technetwork/middleware/ias/toplink-jpa-annotations-096251.html">http://www.oracle.com/technetwork/middleware/ias/toplink-jpa-annotations-096251.html</a></p>
<p>Oh yeah, and here&#8217;s my tip on using cascades: Never use CascadeType.ALL!  Use MERGE, PERSIST, and maybe REMOVE if you want to cascade your deletes.  CascadeType.ALL will result in poor performance and unintended consequences.</p>
<g:plusone href="http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/"></g:plusone><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/&text=JPA+Annotation+Cheatsheet&via=clickonchris&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.clickonchris.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter6.png" alt="Post to Twitter" /></a></p></div><div align="left" style="vertical-align:top;display:inline-block; padding:2px 10px 10px 35px;"><a name="fb_share" type="button" share_url="http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.clickonchris.com/2010/08/jpa-annotation-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configuring Jetty, Maven, and Eclipse together with Hot Swap</title>
		<link>http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/</link>
		<comments>http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/#comments</comments>
		<pubDate>Fri, 28 May 2010 05:06:43 +0000</pubDate>
		<dc:creator>clickonchris</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Hot Swap]]></category>

		<guid isPermaLink="false">http://www.clickonchris.com/?p=186</guid>
		<description><![CDATA[This tutorial will show you how to setup Jetty in embedded mode, and using Eclipse, attach a debugger to enable True Hot Deployment of code onto your Jetty server.]]></description>
			<content:encoded><![CDATA[<p>For over a year I&#8217;ve been developing a Java webapp in Hibernate with maven and Jetty.  Recently I&#8217;ve figure out how to make them all play nice with each other.  For too long I had to restart my application server, which takes upwards of 45 seconds, for any code changes to make it to my development server.  This tutorial will show you how to setup Jetty in embedded mode, and using Eclipse, attach a debugger to enable <strong>True Hot Swap </strong>of code onto your Jetty server.</p>
<p><strong>Environment Information:</strong></p>
<p>JDK 1.5+<br />
Eclipse 3.4.0<br />
maven 2.0.10<br />
m2eclipse 0.9.7 (maven plugin for eclipse)<br />
Jetty 6.1.10<br />
Spring<br />
JPA,Hibernate</p>
<p><span id="more-186"></span></p>
<p><strong>Maven Jetty Configuration:</strong></p>
<p>In your maven project’s pomx.xml, in your &lt;build&gt; section, add the jetty plugin.  An example can be found at the Jetty website here:</p>
<p><a href="http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin#MavenJettyPlugin-WebappConfiguration">http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin#MavenJettyPlugin-WebappConfiguration</a></p>
<p>It is very important to keep &lt;scanIntervalSeconds&gt; set to zero.  This setting tells Jetty how often (in seconds) to scan the webapp for changes and if changes are found, it re-cycles the web container.  You don’t want to do this and setting it to zero will disable it.</p>
<p><strong>Configuring Jetty to start within Eclipse:</strong></p>
<p>Next, create an easy way to launch your jetty server.  I’m using Jetty through Maven and Eclipse.  Here is how I setup an Eclipse External Tool to launch my Jetty server:</p>
<p style="text-align: center;"><a href="http://www.clickonchris.com/wp-content/uploads/2010/05/jettyserver.png"><img class="aligncenter size-full wp-image-188" title="Jetty External Tool Config" src="http://www.clickonchris.com/wp-content/uploads/2010/05/jettyserver.png" alt="" width="666" height="502" /></a></p>
<p>To make sure it is listening for a debugger, make sure that a MAVEN_OPTS environment variable is set with the following options:</p>
<p>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n</p>
<p>The address parameter is what port the jetty server will be listening on for the remote debugger.</p>
<p style="text-align: center;"><a href="http://www.clickonchris.com/wp-content/uploads/2010/05/jettyserver.png"><img class="aligncenter size-full wp-image-188" title="Jetty External Tool Config Environment Tab" src="http://www.clickonchris.com/wp-content/uploads/2010/05/jettyserver.png" alt="" width="666" height="502" /></a></p>
<p>Click ‘Run’ and your jetty server should start running in Eclipse’s console window.  It should look something like this (depending on your log4j config):</p>
<p>Listening for transport dt_socket at address: 4000</p>
<p><pre><code>
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: &#039;jetty&#039;.
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject
[INFO]    task-segment: [jetty:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jetty:run
2010-05-27 15:39:25.733::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server</code></pre></p>
<p><strong>Attaching the Debugger:</strong></p>
<p><strong> </strong>Next, setup a debugger.  In Eclipse open ‘Debug Configurations’, and create a new ‘Remote Java Debugger’.   Select your eclipse project, set the host to localhost, and set the port to 4000, or whatever you defined earlier.</p>
<p><a href="http://www.clickonchris.com/wp-content/uploads/2010/05/debugger.png"><img class="aligncenter size-full wp-image-190" title="Debug Configuration" src="http://www.clickonchris.com/wp-content/uploads/2010/05/debugger.png" alt="" width="587" height="595" /></a></p>
<p>Press the Debug Button and the remote debugger should attach to your jetty server.</p>
<p>Finally, make sure Build Automatically is enabled in eclipse (Project-&gt;Build Automatically).</p>
<p>At this point your environment is enabled for debugging code on your Jetty server through Eclipse.  Breakpoints, watch variables, you name it.</p>
<p>Hot deploy is also enabled.  If you modify some java code, the automatic builder should compile the .java file to a .class file.  The remote debugger will see it and use it, all without restarting your jetty server or its web container.  This will not work for things like adding static variables, new domain classes,  or new injectable service methods that require the application to acknowledge  them on startup.</p>
<g:plusone href="http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/"></g:plusone><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/&text=Configuring+Jetty%2C+Maven%2C+and+Eclipse+together+with+Hot+Swap&via=clickonchris&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.clickonchris.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter6.png" alt="Post to Twitter" /></a></p></div><div align="left" style="vertical-align:top;display:inline-block; padding:2px 10px 10px 35px;"><a name="fb_share" type="button" share_url="http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

