Here it is my last easy patch,
It caches the getProviderIsInClass it seems to be called a lot, it seems that the first cache of translateURI..JCE is not enougth. All in All in my test cases it seems to speed the things a little, from 1.4sec to 10ms, but i think is not a great thing in a bigger case but everythings helps.


That is my last easy patch, I will try to go inside Canonicalizer20010315Excl because is more or less the 80% of the time of my execution. If anyone has some idea of what to look for, please tell me.

Thanks in advance,

Regards,


Index: JCEMapper.java
===================================================================
RCS file: /home/cvspublic/xml-security/src/org/apache/xml/security/algorithms/JCEMapper.java,v
retrieving revision 1.20
diff -u -r1.20 JCEMapper.java
--- JCEMapper.java 14 Apr 2004 21:38:44 -0000 1.20
+++ JCEMapper.java 15 Apr 2004 15:30:02 -0000
@@ -53,6 +53,8 @@
private static Map uriToProvider = new HashMap();


+   private static Map cacheProviderIsInClassPath = new HashMap();
+
   /**
    * Method init
    *
@@ -120,6 +122,14 @@

boolean available = false;

+ Boolean isInClassPath=(Boolean) cacheProviderIsInClassPath.get(providerId);
+ if ((isInClassPath!=null) && isInClassPath.booleanValue()) {
+ //Don't cache the negatives one, in case that latter are added
+ //To the classpath
+ //FIXME: Can the above happend?
+ return true;
+ }
+ try {
/* Allow for mulitple provider entries with same Id */
NodeList providers = XPathAPI.selectNodeList(JCEMapper._providerList,
@@ -149,7 +159,7 @@
} catch (TransformerException ex) {
//do nothing
}
-
+ cacheProviderIsInClassPath.put(providerId,new Boolean(available));
return available;
}


@@ -181,15 +191,13 @@
   public static ProviderIdClass translateURItoJCEID(String AlgorithmURI) {

log.debug("Request for URI " + AlgorithmURI);
-
+ ProviderIdClass prov=(ProviderIdClass) uriToProvider.get(AlgorithmURI);
+ if (prov!=null) {
+ return prov;
+ }
+ try {
- - ProviderIdClass prov=(ProviderIdClass)
- uriToProvider.get(AlgorithmURI);
- if (prov!=null) {
- return prov;
- }
-
+ NodeList providers = XPathAPI.selectNodeList(JCEMapper._providerList,
"./x:Algorithms/x:[EMAIL PROTECTED]'"
+ AlgorithmURI + "']/x:ProviderAlgo",




Reply via email to