[jboss-user] [JBoss Portal] - PortalCMSCacheLoader.java optimization

frontline do-not-reply at jboss.com
Wed Apr 9 08:05:55 EDT 2008

I noticed that the method lookupNodeId in this class got quite slow when I had many entries in the CMS. 
It seems to loop through the nodeNames hash values and search for a match and then returns the key.
I made an additional hash "nodeIds" which is the reverse of the hash mentioned above so from here this method can lookup the value straight.
I just added this to parseNodeName where the hash is used:

PortalCMSCacheLoader.nodeNames.put(id, node);
  | // added this line
  | PortalCMSCacheLoader.nodeIds.put(node, id);
And then the lookupNodeId method becomes just:
return (String)nodeIds.get(nodeName);

This improved performance noticeably.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142692#4142692

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142692

More information about the jboss-user mailing list