Called by: Marcel Maatkamp Total tally on this call : 8
YEA (8) : Eduard Witteveen, Kees Jongenburger, Rob Vermeulen, Nico Klasens, Rico Jansen, Rob van Maris, Michiel Meeuwissen, Vincent van der Locht, Pierre van Rooden
ABSTAIN (0) :
NAY (0) :
VETO (0) :
No votes, assumed abstained (7): Jaco de Groot, David van Zeventer, Johannes Verelst, Gerard van Enk, Mark Huijser, Daniel Ockeloen
Result: vote passed,
Performance improvement can be added.
Preference is a solution which does not use a Hashtable (which is synchronised and needs to be searched), but a single member variable, as there will only be one databse url per mmbase instance.
Marcel Maatkamp wrote:
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; }
-- Pierre van Rooden Mediapark, C 107 tel. +31 (0)35 6772815 "Never summon anything bigger than your head."
