cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <glen.ma...@verizon.net>
Subject Re: svn commit: r577543 - in /incubator/cxf/trunk/rt/transports/http-jetty/src: main/java/org/apache/cxf/transport/http_jetty/ test/java/org/apache/cxf/transport/http_jetty/
Date Thu, 20 Sep 2007 11:40:33 GMT
Am Donnerstag, den 20.09.2007, 04:37 +0000 schrieb ningjiang@apache.org:
> Author: ningjiang
> Date: Wed Sep 19 21:37:31 2007
> New Revision: 577543
> 
> URL: http://svn.apache.org/viewvc?rev=577543&view=rev
> Log:
> CXF-1034 added the servantcount check and the unit test
> 
> Modified:
>     incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
>     incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
>     incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
>     incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
> 
> Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=577543&r1=577542&r2=577543&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
> +++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Wed Sep 19 21:37:31 2007
> @@ -165,7 +165,11 @@
>       * remove it from the factory's cache. 
>       */
>      public void shutdown() {
> -        factory.destroyForPort(port);
> +        if (servantCount == 0) {
> +            factory.destroyForPort(port);
> +        } else {
> +            LOG.log(Level.WARNING, "FAILED_TO_SHOWDOWN_ENGINE_MSG", port);

..._TO_SHUTDOWN_ENGINE


> +        }
>      }
>      
>      /**
> 
> Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java?rev=577543&r1=577542&r2=577543&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
(original)
> +++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
Wed Sep 19 21:37:31 2007
> @@ -205,21 +205,21 @@
>      }
>  
>      public void postShutdown() {
> -        // clean up the collections       
> -        portMap.clear();
> -        threadingParametersMap.clear();
> -        tlsParametersMap.clear();
> -    }
> -
> -    public void preShutdown() {
> -        // shut down the jetty server in the portMap
> +        //shut down the jetty server in the portMap
>          // To avoid the CurrentModificationException, 
> -        // do not use portMap.vaules directly
> -       
> +        // do not use portMap.vaules directly       
>          JettyHTTPServerEngine[] engines = portMap.values().toArray(new JettyHTTPServerEngine[0]);
>          for (JettyHTTPServerEngine engine : engines) {
>              engine.shutdown();
>          }
> +        // clean up the collections
> +        threadingParametersMap.clear();
> +        tlsParametersMap.clear();
> +    }
> +
> +    public void preShutdown() {
> +        // do nothing here 
> +        // just let server registry to call the server stop first
>      }
>      
>  }
> 
> Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties?rev=577543&r1=577542&r2=577543&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
(original)
> +++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
Wed Sep 19 21:37:31 2007
> @@ -22,3 +22,4 @@
>  ADD_HANDLER_FAILED_MSG = Could not add cxf jetty handler to Jetty server: {0}
>  REMOVE_HANDLER_FAILED_MSG = Could not remove cxf jetty handler from Jetty server: {0}
>  CAN_NOT_FIND_HANDLER_MSG = Could not find the handler to remove for context url {0}
> +FAILED_TO_SHOWDOWN_ENGINE_MSG = Failed to shutdown the Jetty server: {0} because it
still be used.

...because it is still being used.

> \ No newline at end of file
> 
> Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java?rev=577543&r1=577542&r2=577543&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
(original)
> +++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
Wed Sep 19 21:37:31 2007
> @@ -148,6 +148,7 @@
>      @Test 
>      public void testaddServants() throws Exception {
>          String urlStr = "http://localhost:1234/hello/test";
> +        String urlStr2 = "http://localhost:1234/hello233/test";
>          JettyHTTPServerEngine engine = 
>              factory.createJettyHTTPServerEngine(1234, "http");
>          JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1");
> @@ -168,8 +169,15 @@
>              fail("Can't get the reponse from the server " + ex);

response

>          }
>          assertEquals("the jetty http handler did not take effect", response, "string1string2");
> -        
> -        
> +        engine.addServant(new URL(urlStr2), handler2);
> +        engine.removeServant(new URL(urlStr));
> +        engine.shutdown();
> +        try {
> +            response = getResponse(urlStr2);
> +        } catch (Exception ex) {
> +            fail("Server should work, even we call the shutdown" + ex);

Server should still work, even if we call the shutdown

> +        }
> +        assertEquals("the jetty http handler did not take effect", response, "string2");
>          // set the get request
>          factory.destroyForPort(1234);       
>          
> 
> 


Mime
View raw message