CALL BY: Marcel Maatkamp
CALL FOR: Performance enhancement 1.6 1.7 org.mmbase.module.database.JDBC

Caching the method 
 public String org.mmbase.module.database.JDBC.makeUrl(String host,int port,String 
dbm) 

This makeUrl() parses, each and every time a query is being executed, a string like 
jdbc:informix-sqli://$HOST:$PORT/vpro:informixserver=digitaal2 into a real JDBC-url. 

I have counted how many times this method is being called on our server, from starting
the server to being ready to serve pages, and it stops at 394 queries. 

Proposing to cache this method by means of a Hashtable. 

The parameters are the key, the value is the result. Since the method is
only calling semi-static variables (init'ed at startup-time), no problems are
expected to arise from caching. 

Code-proposal:

public String makeUrl(String host,int port,String dbm) {
   String key = host+port+dbm;
   String value = (String)cache.get(key);
   if(value!=null) return value;

   otherwise calculate and cache.put(value);
   return value;
}

 START OF CALL: 14/11/2003 12:00
 END OF CALL:  19/11/2003 12:00

 [_] +1 (YEA)

 [_] +0 (ABSTAIN )

 [_] -1 (NAY), because :

 [_] VETO, because:


Reply via email to