Author: dkulp
Date: Mon Oct 8 09:45:02 2007
New Revision: 582876
URL: http://svn.apache.org/viewvc?rev=582876&view=rev
Log:
Merged revisions 577543 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r577543 | ningjiang | 2007-09-20 00:37:31 -0400 (Thu, 20 Sep 2007) | 1 line
CXF-1034 added the servantcount check and the unit test
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 8 09:45:02 2007
@@ -1 +1 @@
-/incubator/cxf/trunk:1-573657,573659-573660,573662-574161,574163-574834,574836-575221,575223-575253,575255-576654,576656-576672,576674-576710,576712-576775,576777-576788,576790-576791,576793-576831,576833-577091,577477
+/incubator/cxf/trunk:1-573657,573659-573660,573662-574161,574163-574834,574836-575221,575223-575253,575255-576654,576656-576672,576674-576710,576712-576775,576777-576788,576790-576791,576793-576831,576833-577091,577477,577543
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=582876&r1=582875&r2=582876&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Mon Oct 8 09:45:02 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);
+ }
}
/**
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java?rev=582876&r1=582875&r2=582876&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineFactory.java
Mon Oct 8 09:45:02 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/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties?rev=582876&r1=582875&r2=582876&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
Mon Oct 8 09:45:02 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.
\ No newline at end of file
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java?rev=582876&r1=582875&r2=582876&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
Mon Oct 8 09:45:02 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);
}
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);
+ }
+ assertEquals("the jetty http handler did not take effect", response,
"string2");
// set the get request
factory.destroyForPort(1234);