|
From: <jue...@we...> - 2004-03-30 07:28:50
|
+1 - sounds plausible to me
BTW, I'll be done for 1.0.1 soon, so it would be good to get this in =
promptly.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Rod Johnson
Sent: Tuesday, March 30, 2004 8:09 AM
To: spr...@li...
Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product
Name lookup
+1
----- Original Message -----
From: "Thomas Risberg" <tho...@tr...>
To: <spr...@li...>
Sent: Tuesday, March 30, 2004 3:54 AM
Subject: [Springframework-developer] SQLErrorCodesFactory Product Name
lookup
> I have been watching my logs and the constant lookup of the database
> product name is bothering me. Colin had the same issue a while ago, =
but
> we never really resolved it. I have a potential solution which =
entails
> storing the hash code of the datasource along with the retreived
> database product name in a static HashMap. Next time, before looking =
up
> the name we could check this HashMap and pull the name from there if =
it
> is found. Can anyone see a flaw in this solution? Any chance of two
> datasource objects having the same hash code? Any chance of a
> datasource switching to a different database while we are running?
>
> Here is the added code:
>
> public SQLErrorCodes getErrorCodes(DataSource ds) {
> // Lets avoid looking up database product info if we can.
> Integer dataSourceHash =3D new Integer(ds.hashCode());
> if (dataSourceProductName.containsKey(dataSourceHash)) {
> String dataSourceDbName =3D
> (String)dataSourceProductName.get(dataSourceHash);
> logger.info("Database Product found in cache {" +
> dataSourceHash + "}. Name is " + dataSourceDbName);
> return getErrorCodes(dataSourceDbName);
> }
> // We could not find it - got to look it up.
> logger.info("Looking up default SQLErrorCodes for =
DataSource");
> ... (this part is already there)
>
> Thomas
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> =
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|