<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
  <title>Sampsa Sohlman</title>
  <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/rss" />
  <subtitle>Sampsa Sohlman</subtitle>
  <entry>
    <title>Building Custom Liferay with maven</title>
    <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/building-custom-liferay-with-maven" />
    <author>
      <name>Sampsa Sohlman</name>
    </author>
    <id>http://sampsa.sohlman.com/fi/home/-/blogs/building-custom-liferay-with-maven</id>
    <updated>2011-04-12T21:42:27Z</updated>
    <published>2011-04-12T10:19:09Z</published>
    <summary type="html">&lt;h1&gt;
	Overview&lt;/h1&gt;
&lt;p&gt;
	Many of us are using maven for the build process, but traditionally Liferay has build with ant. Also Liferay's plugin sdk is based on ant. Liferay has also maven support, which is currently usable limited plugin development. This blog is adding new dimension for Liferay development by building custom Liferay with maven. This works with Community and EE versions as well older Liferay versions. I've done some testing also with 5.1.2.&lt;/p&gt;
&lt;p&gt;
	I usually find out that just creating plugins are not enough - the Liferay API just does not have punch enough - many times there is easily fixable bug in Liferay. Normally you have to build your own Liferay from source or use ext-plugin to override Liferay's core functionality. This blog explains how to build custom Liferay with maven and how to prepare environment.&lt;/p&gt;
&lt;h1&gt;
	Solution&lt;/h1&gt;
&lt;p&gt;
	The solution is to modify Liferay jar and war packages with maven plugins. There two handy maven plugins: maven-shade-plugin and maven-war-plugin.&lt;/p&gt;
&lt;p&gt;
	Maven shade-plugin can do some refactoring and class replacements. This is useful for modifying Liferay jar files including fixes for Liferay. This requires that you know where classes are located. Liferay also provides hot fixes for EE as source format, which can be included on your build. Shade plugin also allows easy tracking of changes. You only have to include changed files to your maven module. Unlike ext-plugin, shade does not use just classloader to replace classes, but really replacing them with your modified version on target jar file, which is more secure.&lt;/p&gt;
&lt;p&gt;
	Mavenwar-plugin can do same for war files as shade-plugin does for jar archives, so here you can harden your Liferay build and remove example unnecessary filters.&lt;/p&gt;
&lt;p&gt;
	To be able to build Liferay with maven all the Liferay required dependencies should be available. On Liferay 6.0.6 there is 175 dependency jars at lib/portal directory. To find out and maintain real maven version for each of these is too big task. So basically I just import all of them to my maven repository.&lt;/p&gt;
&lt;h1&gt;
	How to do it?&lt;/h1&gt;
&lt;p&gt;
	To make this also easier, I have created ant script to install and deploy all necessary artifacts to your maven repository.&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://sampsa.sohlman.com/documents/10418/cba92fad-db24-4ef5-adea-c5405e535348" target="_blank"&gt;maven-custom-build.xml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	This ant script also uses different group id "liferay" to avoid confict with public Liferay group id - "com.liferay".&lt;/p&gt;
&lt;p&gt;
	When using this script you need to have Liferay source, Liferay war and Liferay tomcat bundle available. Tomcat, because the Liferay dependencies package does not contain support-tomcat.jar, which is included on tomcat bundle.&lt;/p&gt;
&lt;p&gt;
	Unzip packages to following directory structure:&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				/source/&lt;/td&gt;
			&lt;td&gt;
				Here is liferay source&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				/liferay-portal/tomcat/&lt;/td&gt;
			&lt;td&gt;
				here is tomcat with liferay&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				/portal-web.war&lt;/td&gt;
			&lt;td&gt;
				and this is really liferay.war&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	Copy build-custom-maven.xml to liferay /source/ directory&lt;/p&gt;
&lt;p&gt;
	execute script:&lt;/p&gt;
&lt;pre&gt;
ant -f build-custom-maven.xml install&lt;/pre&gt;
&lt;p&gt;
	Script modifies all the group id's for Liferay's standard plugins so those can be installed too.&lt;/p&gt;
&lt;pre&gt;
cd support-maven 	
mvn install
&lt;/pre&gt;
&lt;p&gt;
	Script also creates maven project called all-portal-dependencies and you have install that too.&lt;/p&gt;
&lt;pre&gt;
cd all-portal-dependencies
mvn install
&lt;/pre&gt;
&lt;p&gt;
	Now all the dependencies has been installed to your local repository. If you wish to deploy artifacts to your own maven repository server run &lt;strong&gt;ant -f build-custom-maven.xml&lt;/strong&gt; deploy, but remember to check repository settings on build-custom-maven.xml and also you have to modify pom.xml files.&lt;/p&gt;
&lt;p&gt;
	 &lt;/p&gt;
&lt;h2&gt;
	Create project structure for Liferay&lt;/h2&gt;
&lt;p&gt;
	Project structure should be following, but you should only include modules that you are modifying and then add Liferay module if there is change.&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://sampsa.sohlman.com/image/image_gallery?uuid=2b856226-765b-4166-b3b2-3ff23b8a80aa&amp;amp;groupId=10418&amp;amp;t=1302606260508"&gt;&lt;img alt="" src="http://sampsa.sohlman.com/image/image_gallery?uuid=2b856226-765b-4166-b3b2-3ff23b8a80aa&amp;amp;groupId=10418&amp;amp;t=1302606260508" style="width: 410px; height: 340px; " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	The portal-web is the liferay web application and it's pom.xml contains following.&lt;/p&gt;
&lt;pre&gt;
&amp;lt;dependency&amp;gt;
      &amp;lt;groupid&amp;gt;liferay.portal&amp;lt;/groupid&amp;gt;
      &amp;lt;artifactid&amp;gt;portal-web&amp;lt;/artifactid&amp;gt;
      &amp;lt;version&amp;gt;${liferay-version}&amp;lt;/version&amp;gt;
      &amp;lt;type&amp;gt;war&amp;lt;/type&amp;gt;
      &amp;lt;scope&amp;gt;runtime&amp;lt;/scope&amp;gt;
  &amp;lt;/dependency&amp;gt;    
..
  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
..
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupid&amp;gt;org.apache.maven.plugins&amp;lt;/groupid&amp;gt;
        &amp;lt;artifactid&amp;gt;maven-war-plugin&amp;lt;/artifactid&amp;gt;
        &amp;lt;version&amp;gt;2.1&amp;lt;/version&amp;gt;
        &amp;lt;configuration&amp;gt;
          &amp;lt;outputfilenamemapping&amp;gt;@{artifactId}@.@{extension}@&amp;lt;/outputfilenamemapping&amp;gt;
          &amp;lt;overlays&amp;gt;
            &amp;lt;overlay&amp;gt;
              &amp;lt;!-- empty groupId/artifactId represents the current build --&amp;gt;
            &amp;lt;/overlay&amp;gt;
            &amp;lt;overlay&amp;gt;
              &amp;lt;groupid&amp;gt;liferay.portal&amp;lt;/groupid&amp;gt;
              &amp;lt;artifactid&amp;gt;portal-web&amp;lt;/artifactid&amp;gt;
            &amp;lt;/overlay&amp;gt;
          &amp;lt;/overlays&amp;gt;
        &amp;lt;/configuration&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
    &amp;lt;finalname&amp;gt;ROOT&amp;lt;/finalname&amp;gt;
  &amp;lt;/build&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
	The /src/main/webapp directory contains all the changes that you are doing for the webapp like own custom web.xml. If you like to add new artifact for project just add it to dependencies.&lt;/p&gt;
&lt;p&gt;
	If you need to fix example portal-impl.jar, create module for that and use shade plugin. With shade plugin you only have to code that has been changed, so your version control does not contain original Liferay code, which is makes upgrade more confusing.&lt;/p&gt;
&lt;p&gt;
	To configure shade plugin do following example is portal-impl.&lt;/p&gt;
&lt;pre&gt;
..
      &amp;lt;plugin&amp;gt;&amp;lt;groupid&amp;gt;org.apache.maven.plugins&amp;lt;/groupid&amp;gt;
        &amp;lt;artifactid&amp;gt;maven-shade-plugin&amp;lt;/artifactid&amp;gt;
        &amp;lt;version&amp;gt;1.4&amp;lt;/version&amp;gt;
        &amp;lt;executions&amp;gt;
          &amp;lt;execution&amp;gt;
            &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
              &amp;lt;goal&amp;gt;shade&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
              &amp;lt;artifactset&amp;gt;
                &amp;lt;includes&amp;gt;
                  &amp;lt;include&amp;gt;liferay.portal:portal-impl&amp;lt;/include&amp;gt;
                &amp;lt;/includes&amp;gt;
              &amp;lt;/artifactset&amp;gt;
            &amp;lt;/configuration&amp;gt;
          &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
      
..
  &amp;lt;dependency&amp;gt;
    &amp;lt;groupid&amp;gt;liferay.portal&amp;lt;/groupid&amp;gt;
    &amp;lt;artifactid&amp;gt;portal-impl&amp;lt;/artifactid&amp;gt;
    &amp;lt;version&amp;gt;${liferay-version}&amp;lt;/version&amp;gt;
    &amp;lt;scope&amp;gt;compile&amp;lt;/scope&amp;gt;
  &amp;lt;/dependency&amp;gt;
..&lt;/pre&gt;
&lt;p&gt;
	All the other dependencies scope should be provided or they would be included also to same jar. Now if you want to override Liferay's default class with your own just add that to /src/main/java folder and your fix has been included.&lt;/p&gt;
&lt;p&gt;
	As an attachment there this empty version of this liferay maven build. It is relying that you are doing the deployment with Liferay version 6.0.6.&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://sampsa.sohlman.com/documents/10418/705e73a1-a585-4985-9d21-e67024e28802" target="_blank"&gt;custom-liferay.zip&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
	Install to tomcat&lt;/h1&gt;
&lt;p&gt;
	To install this, one easy way is to use Liferay 6.0.6 tomcat package as base package and remove &amp;lt;tomcat root&amp;gt;/webapps/ROOT directory and copy portal-web/target/ROOT.war.&lt;/p&gt;
&lt;p&gt;
	Also copy portal-service.jar and support-tomcat.jar to &amp;lt;tomcat root&amp;gt;/lib/ext/. if you have changed those.&lt;/p&gt;
&lt;h1&gt;
	Final words&lt;/h1&gt;
&lt;p&gt;
	I have had good experiences this kind of Liferay build. It fit's well continous integration and it is make's Liferay customization upgrade easy and trackable. Actually at time of writing the current portal is based on &lt;a href="http://sampsa.sohlman.com/documents/10418/705e73a1-a585-4985-9d21-e67024e28802" target="_blank"&gt;custom-liferay.zip&lt;/a&gt;&lt;/p&gt;</summary>
    <dc:creator>Sampsa Sohlman</dc:creator>
    <dc:date>2011-04-12T10:19:09Z</dc:date>
  </entry>
  <entry>
    <title>Google's mod_pagespeed and Liferay</title>
    <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/google-s-mod_pagespeed-and-liferay" />
    <author>
      <name>Sampsa Sohlman</name>
    </author>
    <id>http://sampsa.sohlman.com/fi/home/-/blogs/google-s-mod_pagespeed-and-liferay</id>
    <updated>2010-11-04T21:57:20Z</updated>
    <published>2010-11-04T21:54:39Z</published>
    <summary type="html">&lt;p&gt;
	Today I did pop into Google's article &lt;a href="http://googlewebmastercentral.blogspot.com/2010/11/make-your-websites-run-faster.html" target="_blank"&gt;Make your websites run faster, automatically -- try mod_pagespeed for Apache"&lt;/a&gt;. Google has created apache mod for page optimization, so I had to try it and I did install it&amp;nbsp; to my site. This&amp;nbsp; mod_pagespeed did came with excelent installation instructions, so the installation job took less than a minute!!&lt;/p&gt;
&lt;p&gt;
	Installation did add some new mods and configurations to my apache.&lt;/p&gt;
&lt;pre&gt;
/etc/apache2/mods-available/pagespeed.load
/etc/apache2/mods-available/pagespeed.conf
&lt;/pre&gt;
&lt;p&gt;
	and it did enable that automaticly&lt;/p&gt;
&lt;pre&gt;
/etc/apache2/mods-enabled/pagespeed.load
/etc/apache2/mods-enabled/pagespeed.conf
&lt;/pre&gt;
&lt;p&gt;
	and following directory was created.&lt;/p&gt;
&lt;pre&gt;
/etc/apache2/mod_pagespeed
&lt;/pre&gt;
&lt;h1&gt;
	Testing&lt;/h1&gt;
&lt;p&gt;
	I did some testing and did use &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/6647/" target="_blank"&gt;Firefox HttpFox &lt;/a&gt;plugin to getting results from my home page.&lt;/p&gt;
&lt;p&gt;
	Liferay it self is quite good for optimizing page loading with minimizing and combining css ja javascript. Without mod_pagespeed there where 26 requests and reload most of the requests did return http 304 (not modified).&lt;/p&gt;
&lt;p&gt;
	With mod_pagespeed actually the request amount was only 21, which is five less - nice. Reload was same 21 request with most of 304 (not modified). Nice thing about this is that it knows automaticly how to combine javascripts,css and also images to one file. Strange is that html size did increase. See the results below.&lt;/p&gt;
&lt;h2&gt;
	Results&lt;/h2&gt;
&lt;table&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;th&gt;
				 &lt;/th&gt;
			&lt;th 2="" colspan=""&gt;
				with page_speed&lt;/th&gt;
			&lt;th colspan="2"&gt;
				without page_speed&lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;
				 &lt;/th&gt;
			&lt;th&gt;
				Received bytes&lt;/th&gt;
			&lt;th&gt;
				Request count&lt;/th&gt;
			&lt;th&gt;
				Received bytes&lt;/th&gt;
			&lt;th&gt;
				Request count&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				text/css&lt;/td&gt;
			&lt;td&gt;
				19423&lt;/td&gt;
			&lt;td&gt;
				2&lt;/td&gt;
			&lt;td&gt;
				21135&lt;/td&gt;
			&lt;td&gt;
				4&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				text/javascript&lt;/td&gt;
			&lt;td&gt;
				126620&lt;/td&gt;
			&lt;td&gt;
				3&lt;/td&gt;
			&lt;td&gt;
				128259&lt;/td&gt;
			&lt;td&gt;
				4&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				image/png&lt;/td&gt;
			&lt;td&gt;
				86136&lt;/td&gt;
			&lt;td&gt;
				13&lt;/td&gt;
			&lt;td&gt;
				81402&lt;/td&gt;
			&lt;td&gt;
				15&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				image/gif&lt;/td&gt;
			&lt;td&gt;
				8645&lt;/td&gt;
			&lt;td&gt;
				1&lt;/td&gt;
			&lt;td&gt;
				11565&lt;/td&gt;
			&lt;td&gt;
				1&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				text/html&lt;/td&gt;
			&lt;td&gt;
				8456&lt;/td&gt;
			&lt;td&gt;
				2&lt;/td&gt;
			&lt;td&gt;
				2054&lt;/td&gt;
			&lt;td&gt;
				2&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				 &lt;/td&gt;
			&lt;td&gt;
				249280&lt;/td&gt;
			&lt;td&gt;
				21&lt;/td&gt;
			&lt;td&gt;
				244415&lt;/td&gt;
			&lt;td&gt;
				26&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
	Conclusion&lt;/h1&gt;
&lt;p&gt;
	During the page load tests I did not find out any strange behavior, but when I did log in to Liferay. I did encounter that page load got stuck. When did disable mod_pagespeed, site did worked fine again. So my conclusion for this point is to wait this to get more mature. Anyway idea behind is great and it is clearly do able.&lt;/p&gt;</summary>
    <dc:creator>Sampsa Sohlman</dc:creator>
    <dc:date>2010-11-04T21:54:39Z</dc:date>
  </entry>
  <entry>
    <title>Liferay, jUnit, Mocking and Spring beans</title>
    <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/liferay-junit-mocking-and-spring-beans" />
    <author>
      <name>Sampsa Sohlman</name>
    </author>
    <id>http://sampsa.sohlman.com/fi/home/-/blogs/liferay-junit-mocking-and-spring-beans</id>
    <updated>2010-10-11T22:30:13Z</updated>
    <published>2010-10-11T15:39:39Z</published>
    <summary type="html">&lt;p&gt;
	When developing Liferay war plugins with good junit test coverage - the mocking of Liferay api and services is important. Unit testing Liferay API is challenging, because all the API is wrapped on static util classes.&lt;/p&gt;
&lt;p&gt;
	One typical case in Liferay development is to get web content article:&lt;/p&gt;
&lt;pre&gt;
String article = JournalContentUtil.getContent(..);
&lt;/pre&gt;
&lt;p&gt;
	&lt;br /&gt;
	These static util classes can be mocked with &lt;a href="http://code.google.com/p/powermock/"&gt;PowerMock(ito)&lt;/a&gt;, but there are drawbacks. Powermock unit tests are usually quite slow and top of that Powermock contains nasty &lt;a href="http://code.google.com/p/powermock/issues/detail?id=207&amp;amp;sort=priority"&gt;memory leak&lt;/a&gt;, which is increasing by each test and which makes huge amount of unit tests quite memory consuming (exactly permgen space consuming). You can get around this by set maven to fork each test, but that does tests even slower.&lt;/p&gt;
&lt;p&gt;
	This was a problem real problem for me until now, &amp;nbsp;because I took more deeper look on Liferay source code and exactly the design of one of the liferay services. That was JournalArticleServiceUtil.java and it contains following line of code:&lt;/p&gt;
&lt;pre&gt;
service = (JournalArticleService)PortalBeanLocatorUtil.locate(JournalArticleService.class.getName());
&lt;/pre&gt;
&lt;p&gt;
	&lt;br /&gt;
	When I did look this line, it came to me that I could use Spring FactoryBean to get hold on Liferay spring beans without Util class. Code would be much cleaner and there would not be static util class pollution* on mycode. PortalBeanLocatorUtil it self is allowing to do cross classloader calls which allows us to make use of Liferay's spring beans.&lt;/p&gt;
&lt;pre&gt;
import org.springframework.beans.factory.FactoryBean;
import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;

public class LiferayFactoryBean implements FactoryBean {
	private Class type;

	public void setType(final Class type) {
		this.type = type;
	}

	@Override
	public Object getObject() throws Exception {
		return PortalBeanLocatorUtil.locate(type.getName());
	}

	@Override
	public Class getObjectType() {
		return type;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}
}
&lt;/pre&gt;
&lt;p&gt;
	&lt;br /&gt;
	The JournalContentUtil is lacking of the the call PortalBeanLocatorUtil.locate(..), but instead there is just setter. When you are going to look liferay Spring files inside portal-impl/META-INF/util-spring.xml you can find JournalContent also there, so you can use PortalBeanLocatorUtil.locate(..) for that too.&lt;/p&gt;
&lt;p&gt;
	So let's make bean declaration to our portal application's spring applicationContext:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean id="journalContent" class="example.spring.LiferayFactoryBean" lazy-init="true"&amp;gt;
		&amp;lt;property name="type" value="com.liferay.portlet.journalcontent.util.JournalContent"/&amp;gt;
	&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
	&lt;br /&gt;
	Create Spring MVC controller (and here we are using autowiring):&lt;/p&gt;
&lt;pre&gt;
@Controller
@RequestMapping("VIEW")
public class ExampleController {
	@Autowired
	private JournalContent journalContent;
	
	.. some code ..

	@ModelAttribute("content")
	public String getContent(RenderRequest request) {
		.. some code ..
		// Old way
		// JournalContentUtil.getContent(groupId, articleId, viewMode, languageId, themeDisplay)
		// New way
		return journalContent.getContent(groupId, articleId, viewMode, languageId, themeDisplay);
	}
}
&lt;/pre&gt;
&lt;p&gt;
	&lt;br /&gt;
	Now when I create test for my class I can mock easily mock JournalContent without using Powermock.&lt;/p&gt;</summary>
    <dc:creator>Sampsa Sohlman</dc:creator>
    <dc:date>2010-10-11T15:39:39Z</dc:date>
  </entry>
  <entry>
    <title>Little library for java application profiling</title>
    <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/little-library-for-java-application-profiling" />
    <author>
      <name>Sampsa Sohlman</name>
    </author>
    <id>http://sampsa.sohlman.com/fi/home/-/blogs/little-library-for-java-application-profiling</id>
    <updated>2010-09-22T19:25:15Z</updated>
    <published>2010-09-22T19:19:20Z</published>
    <summary type="html">&lt;p&gt;
	 &lt;/p&gt;
&lt;div id="cke_pastebin"&gt;
	I did write little library for java profiling, Library is using Threadlocals for storing profiling information. The purpose of this is to collect all performance logs under same section and see performance bottlenecks from logs.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	Example of log:&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Timestamp: &amp;nbsp; Start: Elapsed: &amp;nbsp;ToNext: Action: THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.187 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp;188 &amp;nbsp; &amp;nbsp; &amp;nbsp; 16 root THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.203 &amp;nbsp; &amp;nbsp; &amp;nbsp; 16 &amp;nbsp; &amp;nbsp; &amp;nbsp;172 &amp;nbsp; &amp;nbsp; &amp;nbsp; 31 -com.sohlman.profiler.test.0.Doit.method0(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.234 &amp;nbsp; &amp;nbsp; &amp;nbsp; 47 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 31 --com.sohlman.profiler.test.1.Doit.method0(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.265 &amp;nbsp; &amp;nbsp; &amp;nbsp; 78 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 31 --com.sohlman.profiler.test.1.Doit.method1(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.296 &amp;nbsp; &amp;nbsp; &amp;nbsp;109 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 32 --com.sohlman.profiler.test.1.Doit.method2(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.328 &amp;nbsp; &amp;nbsp; &amp;nbsp;141 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 31 --com.sohlman.profiler.test.1.Doit.method3(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;2010-09-22 20:36:12.359 &amp;nbsp; &amp;nbsp; &amp;nbsp;172 &amp;nbsp; &amp;nbsp; &amp;nbsp; 16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 --com.sohlman.profiler.test.1.Doit.method4(..) THRESHOLD ROWINDENTIFIER&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	This allows easily pin point performance problems and compare those to example jmeter output. Library also contains support for Spring AOP and has also Liferay filter and I'm currently using this under Liferay.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	Liferay filter is where the profiling is started and application profiling calls goes under that.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	To install profiler to Liferay&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	Put profiler-api jar under global class loader example on tomcat &amp;lt;tomcat root&amp;gt;/lib/ext and profiler-liferay under liferay webapp. Tomcat &amp;lt;tomcat root&amp;gt;/webapps/ROOT/WEB-INF/lib. Add following lines top of liferay web.xml&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	 &lt;/div&gt;
&lt;div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;filter&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;filter-name&amp;gt;Thread Local profiler&amp;lt;/filter-name&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;filter-class&amp;gt;com.sohlman.profiler.liferay.filter.ProfilerFilter&amp;lt;/filter-class&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;/filter&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;..&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;filter-mapping&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;filter-name&amp;gt;Thread Local profiler&amp;lt;/filter-name&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;/code&gt;&lt;/div&gt;
	&lt;div id="cke_pastebin"&gt;
		&lt;code&gt;&amp;lt;/filter-mapping&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
	 &lt;/div&gt;
&lt;div&gt;
	and your code put following&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;Watch watch = ThreadLocalProfiler.start();&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;..&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;code&gt;ThreadLocalProfiler.stop(watch, ..);&lt;/code&gt;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	You can use also Spring aop and profiler-spring-support or both.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	The library is not ment to use on production, because it will generate lot of logs and add little overhead for application execution even though it is designed to minimize gc collection.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	Jar file profiler-liferay does not contain any external dependencies so it can be used independently.&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	More information of this library and download can be found&amp;nbsp;&lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	 &lt;/div&gt;
&lt;div id="cke_pastebin"&gt;
	&lt;a href="http://code.google.com/p/java-threadlocal-profiler/" target="_blank"&gt;http://code.google.com/p/java-threadlocal-profiler/&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
	 &lt;/div&gt;</summary>
    <dc:creator>Sampsa Sohlman</dc:creator>
    <dc:date>2010-09-22T19:19:20Z</dc:date>
  </entry>
  <entry>
    <title>My first entry to personal log</title>
    <link rel="alternate" href="http://sampsa.sohlman.com/fi/home/-/blogs/my-first-entry-to-personal-log" />
    <author>
      <name>Sampsa Sohlman</name>
    </author>
    <id>http://sampsa.sohlman.com/fi/home/-/blogs/my-first-entry-to-personal-log</id>
    <updated>2010-09-18T22:48:37Z</updated>
    <published>2010-09-18T22:31:22Z</published>
    <summary type="html">&lt;p&gt;My first home page was on internet on 1996. Most of the years I have had pages available and my own domain name too. This page is now running on Liferay 5.2 and it is fast. Intel platform fits well for Liferay.&lt;/p&gt;</summary>
    <dc:creator>Sampsa Sohlman</dc:creator>
    <dc:date>2010-09-18T22:31:22Z</dc:date>
  </entry>
</feed>


