You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/01/09 15:03:48 UTC

cvs commit: jakarta-turbine-fulcrum/xmlrpc/src/test/org/apache/fulcrum/xmlrpc XmlRpcComponentTest.java

epugh       2004/01/09 06:03:48

  Modified:    xmlrpc/xdocs changes.xml
               xmlrpc/src/java/org/apache/fulcrum/xmlrpc
                        DefaultXmlRpcServerComponent.java
               xmlrpc/src/test/org/apache/fulcrum/xmlrpc
                        XmlRpcComponentTest.java
  Log:
  Patch from Ronald to unregister component handlers when dispose() method is called.
  
  Revision  Changes    Path
  1.3       +3 -0      jakarta-turbine-fulcrum/xmlrpc/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/xmlrpc/xdocs/changes.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- changes.xml	24 Dec 2003 14:14:35 -0000	1.2
  +++ changes.xml	9 Jan 2004 14:03:48 -0000	1.3
  @@ -8,6 +8,9 @@
   
     <body>
       <release version="Not applicable" date="">
  +      <action dev="ronald" type="fix">
  +        Change Server component to unregister handlers on dispose() method.  Prevents shutdown errors.
  +      </action>       	
         <action dev="ronald" type="add">
           Add merlin meta info generation.  Refactor common code between server and
           client.
  
  
  
  1.2       +19 -4     jakarta-turbine-fulcrum/xmlrpc/src/java/org/apache/fulcrum/xmlrpc/DefaultXmlRpcServerComponent.java
  
  Index: DefaultXmlRpcServerComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/xmlrpc/src/java/org/apache/fulcrum/xmlrpc/DefaultXmlRpcServerComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultXmlRpcServerComponent.java	24 Dec 2003 14:14:35 -0000	1.1
  +++ DefaultXmlRpcServerComponent.java	9 Jan 2004 14:03:48 -0000	1.2
  @@ -60,7 +60,6 @@
   import org.apache.avalon.framework.activity.Startable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  @@ -173,6 +172,7 @@
       public void start()
           throws Exception
       {
  +        getLogger().debug( "Starting the XML-RPC server." );
           webserver.start();
       }
   
  @@ -184,7 +184,7 @@
       {
           super.initialize();
   
  -        getLogger().info( "Attempting to start the XML-RPC server." );
  +        getLogger().info( "Attempting to initialize the XML-RPC server." );
   
           // Need a default value here.
           if (isSecureServer)
  @@ -277,9 +277,14 @@
           }
       }
   
  +    /**
  +     * Shuts down this service, stopping running threads.
  +     */
       public void stop()
           throws Exception
       {
  +        getLogger().debug( "Stopping the XML-RPC server." );
  +
           // Stop the XML RPC server.  org.apache.xmlrpc.WebServer blocks in a
           // call to ServerSocket.accept() until a socket connection is made.
           webserver.shutdown();
  @@ -302,10 +307,20 @@
       // ------------------------------------------------------------------------
   
       /**
  -     * Shuts down this service, stopping running threads.
  +     * Unregisters all handlers and disposes of the server.
        */
       public void dispose()
       {
  +        Configuration[] handlers = handlerConfiguration.getChildren("handler");
  +        for (int i = 0; i < handlers.length; i++)
  +        {
  +            Configuration c = handlers[i];
  +            if (c.getName().equals("handler"))
  +            {
  +                unregisterHandler(c.getChild("name").getValue(""));
  +            }
  +        }
  +
           webserver = null;
       }
   
  
  
  
  1.5       +7 -1      jakarta-turbine-fulcrum/xmlrpc/src/test/org/apache/fulcrum/xmlrpc/XmlRpcComponentTest.java
  
  Index: XmlRpcComponentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/xmlrpc/src/test/org/apache/fulcrum/xmlrpc/XmlRpcComponentTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XmlRpcComponentTest.java	24 Dec 2003 14:14:35 -0000	1.4
  +++ XmlRpcComponentTest.java	9 Jan 2004 14:03:48 -0000	1.5
  @@ -4,6 +4,7 @@
   import java.util.Vector;
   
   import org.apache.fulcrum.testcontainer.BaseUnitTest;
  +import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   
   import junit.framework.TestSuite;
  @@ -54,6 +55,8 @@
               e.printStackTrace();
               fail("Could not lookup component");
           }
  +
  +        release((Component) xmlrpc);
       }
   
       public void testHandler() throws Exception
  @@ -97,5 +100,8 @@
           result = (String) rpcClient.executeRpc(server, "ClassHandler.echo",
                   params);
           assertEquals(result, testMessage);
  +
  +        release((Component) rpcClient);
  +        release((Component) xmlrpc);
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org