You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by hg...@apache.org on 2005/04/22 09:56:43 UTC

cvs commit: ws-xmlrpc/src/java/org/apache/xmlrpc XmlRpcClient.java XmlRpcServer.java

hgomez      2005/04/22 00:56:43

  Modified:    src/java/org/apache/xmlrpc XmlRpcClient.java
                        XmlRpcServer.java
  Log:
  Now we can defined maxThreads (workers in fact) for XmlRPCServer/XmlRPCClient instance.
  Stay compatible with the old way (XmlRpc.getMaxThreads().
  
  Revision  Changes    Path
  1.21      +28 -2     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClient.java
  
  Index: XmlRpcClient.java
  ===================================================================
  RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XmlRpcClient.java	15 Apr 2005 10:21:53 -0000	1.20
  +++ XmlRpcClient.java	22 Apr 2005 07:56:43 -0000	1.21
  @@ -91,6 +91,13 @@
       private CallData first, last;
   
       /**
  +     * The maximum number of threads which can be used concurrently, by defaut use the one defined
  +     * in XmlRpc
  +     */
  +    private int maxThreads = -1;
  +
  +    
  +    /**
        * Construct a XML-RPC client with this URL and a specified transport
        * factory.
        */
  @@ -129,6 +136,25 @@
       }
   
       /**
  +     * Set the MaxThreads for this Client
  +     */
  +    public void setMaxThreads(int maxThreads) 
  +    {
  +    	this.maxThreads = maxThreads;
  +    }
  +    
  +    /**
  +     * Get the MaxThreads for this Client
  +     */
  +    public int getMaxThreads() 
  +    {
  +    	if (maxThreads == -1)
  +    		return (XmlRpc.getMaxThreads());
  +    	
  +    	return (maxThreads);
  +    }
  +    
  +    /**
        * Return the URL for this XML-RPC client.
        */
       public URL getURL()
  @@ -346,7 +372,7 @@
           }
           catch(EmptyStackException x)
           {
  -            if (workers < XmlRpc.getMaxThreads())
  +            if (workers < getMaxThreads())
               {
                   if (async)
                   {
  
  
  
  1.39      +26 -1     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcServer.java
  
  Index: XmlRpcServer.java
  ===================================================================
  RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcServer.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- XmlRpcServer.java	15 Apr 2005 10:21:53 -0000	1.38
  +++ XmlRpcServer.java	22 Apr 2005 07:56:43 -0000	1.39
  @@ -75,6 +75,12 @@
       private int nbrWorkers;
   
       /**
  +     * The maximum number of threads which can be used concurrently, by defaut use the one defined
  +     * in XmlRpc
  +     */
  +    private int maxThreads = -1;
  +
  +    /**
        * We want the <code>$default</code> handler to always be
        * available.
        */
  @@ -116,6 +122,25 @@
       }
   
       /**
  +     * Set the MaxThreads for this Client
  +     */
  +    public void setMaxThreads(int maxThreads) 
  +    {
  +    	this.maxThreads = maxThreads;
  +    }
  +    
  +    /**
  +     * Get the MaxThreads for this Server
  +     */
  +    public int getMaxThreads() 
  +    {
  +    	if (maxThreads == -1)
  +    		return (XmlRpc.getMaxThreads());
  +    	
  +    	return (maxThreads);
  +    }
  +    
  +    /**
        * Parse the request and execute the handler method, if one is
        * found. Returns the result as XML.  The calling Java code
        * doesn't need to know whether the call was successful or not
  @@ -172,7 +197,7 @@
           }
           catch(EmptyStackException x)
           {
  -            int maxThreads = XmlRpc.getMaxThreads();
  +            int maxThreads = getMaxThreads();
               if (nbrWorkers < maxThreads)
               {
                   nbrWorkers += 1;
  
  
  

Re: cvs commit: ws-xmlrpc/src/java/org/apache/xmlrpc XmlRpcClient.java XmlRpcServer.java

Posted by "Daniel L. Rall" <dl...@collab.net>.
Henri, the indentation is off in the new code you added (but preserved
in the pre-existing code which you just changed).  I suspect that you
accidently introduced some tab characters.

On Fri, 2005-04-22 at 07:56 +0000, hgomez@apache.org wrote:
> hgomez      2005/04/22 00:56:43
> 
>   Modified:    src/java/org/apache/xmlrpc XmlRpcClient.java
>                         XmlRpcServer.java
>   Log:
>   Now we can defined maxThreads (workers in fact) for XmlRPCServer/XmlRPCClient instance.
>   Stay compatible with the old way (XmlRpc.getMaxThreads().
>   
>   Revision  Changes    Path
>   1.21      +28 -2     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClient.java
>   
>   Index: XmlRpcClient.java
>   ===================================================================
>   RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v
>   retrieving revision 1.20
>   retrieving revision 1.21
>   diff -u -r1.20 -r1.21
>   --- XmlRpcClient.java	15 Apr 2005 10:21:53 -0000	1.20
>   +++ XmlRpcClient.java	22 Apr 2005 07:56:43 -0000	1.21
>   @@ -91,6 +91,13 @@
>        private CallData first, last;
>    
>        /**
>   +     * The maximum number of threads which can be used concurrently, by defaut use the one defined
>   +     * in XmlRpc
>   +     */
>   +    private int maxThreads = -1;
>   +
>   +    
>   +    /**
>         * Construct a XML-RPC client with this URL and a specified transport
>         * factory.
>         */
>   @@ -129,6 +136,25 @@
>        }
>    
>        /**
>   +     * Set the MaxThreads for this Client
>   +     */
>   +    public void setMaxThreads(int maxThreads) 
>   +    {
>   +    	this.maxThreads = maxThreads;
>   +    }
>   +    
>   +    /**
>   +     * Get the MaxThreads for this Client
>   +     */
>   +    public int getMaxThreads() 
>   +    {
>   +    	if (maxThreads == -1)
>   +    		return (XmlRpc.getMaxThreads());
>   +    	
>   +    	return (maxThreads);
>   +    }
>   +    
>   +    /**
>         * Return the URL for this XML-RPC client.
>         */
>        public URL getURL()
>   @@ -346,7 +372,7 @@
>            }
>            catch(EmptyStackException x)
>            {
>   -            if (workers < XmlRpc.getMaxThreads())
>   +            if (workers < getMaxThreads())
>                {
>                    if (async)
>                    {
>   
>   
>   
>   1.39      +26 -1     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcServer.java
>   
>   Index: XmlRpcServer.java
>   ===================================================================
>   RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcServer.java,v
>   retrieving revision 1.38
>   retrieving revision 1.39
>   diff -u -r1.38 -r1.39
>   --- XmlRpcServer.java	15 Apr 2005 10:21:53 -0000	1.38
>   +++ XmlRpcServer.java	22 Apr 2005 07:56:43 -0000	1.39
>   @@ -75,6 +75,12 @@
>        private int nbrWorkers;
>    
>        /**
>   +     * The maximum number of threads which can be used concurrently, by defaut use the one defined
>   +     * in XmlRpc
>   +     */
>   +    private int maxThreads = -1;
>   +
>   +    /**
>         * We want the <code>$default</code> handler to always be
>         * available.
>         */
>   @@ -116,6 +122,25 @@
>        }
>    
>        /**
>   +     * Set the MaxThreads for this Client
>   +     */
>   +    public void setMaxThreads(int maxThreads) 
>   +    {
>   +    	this.maxThreads = maxThreads;
>   +    }
>   +    
>   +    /**
>   +     * Get the MaxThreads for this Server
>   +     */
>   +    public int getMaxThreads() 
>   +    {
>   +    	if (maxThreads == -1)
>   +    		return (XmlRpc.getMaxThreads());
>   +    	
>   +    	return (maxThreads);
>   +    }
>   +    
>   +    /**
>         * Parse the request and execute the handler method, if one is
>         * found. Returns the result as XML.  The calling Java code
>         * doesn't need to know whether the call was successful or not
>   @@ -172,7 +197,7 @@
>            }
>            catch(EmptyStackException x)
>            {
>   -            int maxThreads = XmlRpc.getMaxThreads();
>   +            int maxThreads = getMaxThreads();
>                if (nbrWorkers < maxThreads)
>                {
>                    nbrWorkers += 1;
>   
>   
>