You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/03/05 18:20:24 UTC

cvs commit: xml-axis/java/src/org/apache/axis/client Call.java

gdaniels    02/03/05 09:20:24

  Modified:    java/src/org/apache/axis/client Call.java
  Log:
  Cache the transport packages we've already added to the system property,
  and only update when we need to.
  
  Revision  Changes    Path
  1.87      +28 -15    xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- Call.java	5 Mar 2002 14:02:12 -0000	1.86
  +++ Call.java	5 Mar 2002 17:20:23 -0000	1.87
  @@ -109,15 +109,7 @@
   import java.io.StringWriter;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.Enumeration;
  -import java.util.Hashtable;
  -import java.util.Vector;
  -import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Set;
  -import java.util.HashMap;
  +import java.util.*;
   
   /**
    * Axis' JAXRPC Dynamic Invocation Interface implementation of the Call
  @@ -1153,6 +1145,12 @@
           setTransportForProtocol("https", HTTPTransport.class);
       }
   
  +    /**
  +     * Cache of transport packages we've already added to the system
  +     * property.
  +     */ 
  +    private static ArrayList transportPackages = null;
  +    
       /** Add a package to the system protocol handler search path.  This
        * enables users to create their own URLStreamHandler classes, and thus
        * allow custom protocols to be used in Axis (typically on the client
  @@ -1167,13 +1165,28 @@
        * @param packageName the package in which to search for protocol names.
        */
       public static synchronized void addTransportPackage(String packageName) {
  -        String currentPackages = System.getProperty(TRANSPORT_PROPERTY);
  -        if (currentPackages == null) {
  -            currentPackages = "";
  -        } else {
  -            currentPackages += "|";
  +        if (transportPackages == null) {
  +            transportPackages = new ArrayList();
  +            String currentPackages = System.getProperty(TRANSPORT_PROPERTY);
  +            if (currentPackages != null) {
  +                StringTokenizer tok = new StringTokenizer(currentPackages,
  +                                                          "|");
  +                while (tok.hasMoreTokens()) {
  +                    transportPackages.add(tok.nextToken());
  +                }
  +            }
  +        }
  +        
  +        if (transportPackages.contains(packageName))
  +            return;
  +        
  +        transportPackages.add(packageName);
  +        
  +        String currentPackages = "";
  +        for (Iterator i = transportPackages.iterator(); i.hasNext();) {
  +            String thisPackage = (String) i.next();
  +            currentPackages += thisPackage;            
           }
  -        currentPackages += packageName;
   
           System.setProperty(TRANSPORT_PROPERTY, currentPackages);
       }