[CXF-6091] Fix problems stoping servers that are using the MultiEndpointObserver Patch from Vadim Beilin applied
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/fae68333 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fae68333 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fae68333 Branch: refs/heads/2.7.x-fixes Commit: fae68333c52e8d67276a776efaaeec9717c89689 Parents: 1bde7c9 Author: Daniel Kulp <[email protected]> Authored: Fri Nov 7 13:40:46 2014 -0500 Committer: Daniel Kulp <[email protected]> Committed: Fri Nov 7 14:44:16 2014 -0500 ---------------------------------------------------------------------- api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java | 9 +++++---- .../cxf/frontend/soap/SoapBindingSelectionTest.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/fae68333/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java b/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java index 9d4d7b3..3654ffa 100644 --- a/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java +++ b/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java @@ -159,11 +159,12 @@ public class ServerImpl implements Server { MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); - if (!((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { - return; + if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { + getDestination().setMessageObserver(null); } - } - getDestination().setMessageObserver(null); + } else { + getDestination().setMessageObserver(null); + } stopped = true; } http://git-wip-us.apache.org/repos/asf/cxf/blob/fae68333/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java ---------------------------------------------------------------------- diff --git a/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java b/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java index a25379b..13277e5 100644 --- a/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java +++ b/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java @@ -94,6 +94,16 @@ public class SoapBindingSelectionTest extends AbstractSimpleFrontendTest { assertFalse(service1Invoked); assertTrue(service2Invoked); + + server2.stop(); + server2.start(); + + nd = invoke("http://localhost/Hello", LocalTransportFactory.TRANSPORT_ID, "soap12.xml"); + assertEquals("http://www.w3.org/2003/05/soap-envelope", getNs(nd)); + + assertFalse(service1Invoked); + assertTrue(service2Invoked); + } private String getNs(Node nd) {
