You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/04/04 16:53:52 UTC
[1/3] cxf git commit: [CXF-7096] Make sure everything is cleaned up
if the destination sequecne times out
Repository: cxf
Updated Branches:
refs/heads/3.1.x-fixes 8d6b79f20 -> 4406683df
[CXF-7096] Make sure everything is cleaned up if the destination sequecne times out
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/15ed5d4f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/15ed5d4f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/15ed5d4f
Branch: refs/heads/3.1.x-fixes
Commit: 15ed5d4f8d4e2443a668c29d96626debcd01a8db
Parents: 8d6b79f
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Apr 4 12:07:45 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue Apr 4 12:53:40 2017 -0400
----------------------------------------------------------------------
.../java/org/apache/cxf/ws/rm/Destination.java | 5 +-
.../apache/cxf/ws/rm/DestinationSequence.java | 15 +-
.../java/org/apache/cxf/ws/rm/RMManager.java | 8 +
.../cxf/ws/rm/DestinationSequenceTest.java | 4 +-
.../cxf/systest/ws/rm/SequenceTimeoutTest.java | 213 +++++++++++++++++++
5 files changed, 237 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/15ed5d4f/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
index 3d3489b..ef1ea1a 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
@@ -78,8 +78,11 @@ public class Destination extends AbstractEndpoint {
// this method ensures to keep the sequence until all the messages are delivered
public void terminateSequence(DestinationSequence seq) {
+ terminateSequence(seq, false);
+ }
+ public void terminateSequence(DestinationSequence seq, boolean forceRemove) {
seq.terminate();
- if (seq.allAcknowledgedMessagesDelivered()) {
+ if (forceRemove || seq.allAcknowledgedMessagesDelivered()) {
removeSequence(seq);
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/15ed5d4f/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
index 3442fc5..d186194 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
@@ -590,11 +590,16 @@ public class DestinationSequence extends AbstractSequence {
// terminate regardless outstanding acknowledgments - as we assume that the client is
// gone there is no point in sending a SequenceAcknowledgment
-
- LogUtils.log(LOG, Level.WARNING, "TERMINATING_INACTIVE_SEQ_MSG",
+ LogUtils.log(LOG, Level.WARNING, "TERMINATING_INACTIVE_SEQ_MSG",
DestinationSequence.this.getIdentifier().getValue());
- DestinationSequence.this.destination.terminateSequence(DestinationSequence.this);
-
+ DestinationSequence.this.destination.terminateSequence(DestinationSequence.this, true);
+ Source source = rme.getSource();
+ if (source != null) {
+ SourceSequence ss = source.getAssociatedSequence(DestinationSequence.this.getIdentifier());
+ if (ss != null) {
+ source.removeSequence(ss);
+ }
+ }
} else {
// reschedule
SequenceTermination st = new SequenceTermination();
@@ -605,4 +610,4 @@ public class DestinationSequence extends AbstractSequence {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/15ed5d4f/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
index a29a6a7..603e8d6 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
@@ -404,6 +404,14 @@ public class RMManager {
}
return rme;
}
+ public RMEndpoint findReliableEndpoint(QName qn) {
+ for (RMEndpoint rpe : reliableEndpoints.values()) {
+ if (qn.equals(rpe.getApplicationEndpoint().getService().getName())) {
+ return rpe;
+ }
+ }
+ return null;
+ }
public Destination getDestination(Message message) throws RMException {
RMEndpoint rme = getReliableEndpoint(message);
http://git-wip-us.apache.org/repos/asf/cxf/blob/15ed5d4f/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
index 546f5f3..72666b8 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
@@ -567,7 +567,7 @@ public class DestinationSequenceTest extends Assert {
DestinationSequence seq = new DestinationSequence(id, ref, destination,
ProtocolVariation.RM10WSA200408);
- destination.terminateSequence(seq);
+ destination.terminateSequence(seq, true);
EasyMock.expectLastCall();
Message message = setUpMessage("1");
@@ -601,7 +601,7 @@ public class DestinationSequenceTest extends Assert {
long lastAppMessage = System.currentTimeMillis() - 30000L;
EasyMock.expect(rme.getLastControlMessage()).andReturn(0L);
EasyMock.expect(rme.getLastApplicationMessage()).andReturn(lastAppMessage);
- destination.terminateSequence(seq);
+ destination.terminateSequence(seq, true);
EasyMock.expectLastCall();
control.replay();
st.run();
http://git-wip-us.apache.org/repos/asf/cxf/blob/15ed5d4f/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTimeoutTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTimeoutTest.java b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTimeoutTest.java
new file mode 100644
index 0000000..0a04564
--- /dev/null
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTimeoutTest.java
@@ -0,0 +1,213 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.rm;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Executor;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.systest.ws.util.ConnectionHelper;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
+import org.apache.cxf.ws.rm.RMEndpoint;
+import org.apache.cxf.ws.rm.RMManager;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ *
+ */
+public class SequenceTimeoutTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = TestUtil.getPortNumber(SequenceTimeoutTest.class);
+ private static final String ADDRESS = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
+ private static final QName GREETME_NAME
+ = new QName("http://cxf.apache.org/greeter_control", "greetMe");
+ private static final QName GREETME_SERVICE_NAME
+ = new QName("http://cxf.apache.org/greeter_control", "GreeterService");
+
+ private static RMManager rmManager;
+
+ private Bus greeterBus;
+ private Greeter greeter;
+
+
+ public static class Server extends AbstractBusTestServerBase {
+ Endpoint endpoint;
+
+ protected void run() {
+ SpringBusFactory bf = new SpringBusFactory();
+ System.setProperty("db.name", "rdbm");
+ Bus bus = bf.createBus("org/apache/cxf/systest/ws/rm/rminterceptors.xml");
+ System.clearProperty("db.name");
+ BusFactory.setDefaultBus(bus);
+
+ setBus(bus);
+
+ rmManager = bus.getExtension(RMManager.class);
+ rmManager.getConfiguration().setInactivityTimeout(1000L);
+
+ //System.out.println("Created control bus " + bus);
+ GreeterImpl greeterImplementor = new GreeterImpl();
+ endpoint = Endpoint.publish(ADDRESS, greeterImplementor);
+
+ BusFactory.setDefaultBus(null);
+ BusFactory.setThreadDefaultBus(null);
+ }
+
+ public void tearDown() throws Exception {
+ endpoint.stop();
+ }
+ }
+
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ assertTrue("server did not launch correctly", launchServer(Server.class, true));
+ }
+
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ private void init(String cfgResource, boolean useDecoupledEndpoint, boolean useDispatchClient) {
+ init(cfgResource, useDecoupledEndpoint, useDispatchClient, null);
+ }
+
+ private void init(String cfgResource,
+ boolean useDecoupledEndpoint,
+ boolean useDispatchClient,
+ Executor executor) {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ initGreeterBus(bf, cfgResource);
+ if (useDispatchClient) {
+ initDispatch();
+ } else {
+ initProxy(useDecoupledEndpoint, executor);
+ }
+ }
+ private void initGreeterBus(SpringBusFactory bf,
+ String cfgResource) {
+ greeterBus = bf.createBus(cfgResource);
+ BusFactory.setDefaultBus(greeterBus);
+ }
+
+
+ private Dispatch<DOMSource> initDispatch() {
+ GreeterService gs = new GreeterService();
+ Dispatch<DOMSource> dispatch = gs.createDispatch(GreeterService.GreeterPort,
+ DOMSource.class,
+ Service.Mode.MESSAGE);
+ try {
+ updateAddressPort(dispatch, PORT);
+ } catch (Exception e) {
+ //ignore
+ }
+ dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.FALSE);
+ dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION, GREETME_NAME);
+
+ return dispatch;
+ }
+
+ private void initProxy(boolean useDecoupledEndpoint, Executor executor) {
+ GreeterService gs = new GreeterService();
+
+ if (null != executor) {
+ gs.setExecutor(executor);
+ }
+
+ greeter = gs.getGreeterPort();
+ try {
+ updateAddressPort(greeter, PORT);
+ } catch (Exception e) {
+ //ignore
+ }
+
+ ConnectionHelper.setKeepAliveConnection(greeter, true);
+ }
+ @Test
+ public void testTimeout() throws Exception {
+ init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true, true);
+
+ List<Dispatch<DOMSource>> dispatches = new ArrayList<>(5);
+ int count = 5;
+ for (int x = 0; x < count; x++) {
+ Dispatch<DOMSource> dispatch = initDispatch();
+ AcksPolicyType ap = new AcksPolicyType();
+ //don't send the acks to cause a memory leak - CXF-7096
+ ap.setImmediaAcksTimeout(500000L);
+ greeterBus.getExtension(RMManager.class).getDestinationPolicy().setAcksPolicy(ap);
+ dispatch.invoke(getDOMRequest("One"));
+ dispatches.add(dispatch);
+ }
+ RMEndpoint ep = rmManager.findReliableEndpoint(GREETME_SERVICE_NAME);
+ Assert.assertNotNull(ep);
+ Assert.assertEquals(count, ep.getDestination().getAllSequences().size());
+ Assert.assertEquals(count, ep.getSource().getAllSequences().size());
+ Thread.sleep(2500);
+ System.gc();
+ Assert.assertEquals(0, ep.getDestination().getAllSequences().size());
+ Assert.assertEquals(0, ep.getSource().getAllSequences().size());
+ try {
+ dispatches.get(0).invoke(getDOMRequest("One"));
+ fail("The sequence should have been terminated");
+ } catch (Throwable t) {
+ //expected
+ Assert.assertTrue(t.getMessage().contains("not a known Sequence identifier"));
+ }
+ rmManager.getStore();
+ }
+ private DOMSource getDOMRequest(String n)
+ throws Exception {
+ InputStream is =
+ getClass().getResourceAsStream("twoway"
+ + "Req" + n + ".xml");
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document newDoc = builder.parse(is);
+ return new DOMSource(newDoc);
+ }
+}
[2/3] cxf git commit: [CXF-7187] Check for the other soap fault
action value to correlate response
Posted by dk...@apache.org.
[CXF-7187] Check for the other soap fault action value to correlate response
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/cf5a6d6e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/cf5a6d6e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/cf5a6d6e
Branch: refs/heads/3.1.x-fixes
Commit: cf5a6d6e83c94f21b1f54d2c48d2be8cef4f972c
Parents: 15ed5d4
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Apr 4 12:31:36 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue Apr 4 12:53:43 2017 -0400
----------------------------------------------------------------------
core/src/main/java/org/apache/cxf/ws/addressing/Names.java | 5 ++++-
.../main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/cf5a6d6e/core/src/main/java/org/apache/cxf/ws/addressing/Names.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/ws/addressing/Names.java b/core/src/main/java/org/apache/cxf/ws/addressing/Names.java
index b80758e..51d2c80 100644
--- a/core/src/main/java/org/apache/cxf/ws/addressing/Names.java
+++ b/core/src/main/java/org/apache/cxf/ws/addressing/Names.java
@@ -109,7 +109,10 @@ public final class Names {
"/fault";
public static final String WSA_DEFAULT_FAULT_ACTION =
WSA_NAMESPACE_NAME + WSA_FAULT_DELIMITER;
-
+
+ public static final String WSA_DEFAULT_SOAP_FAULT_ACTION =
+ WSA_NAMESPACE_NAME + "/soap" + WSA_FAULT_DELIMITER;
+
public static final String WSAW_ACTION_NAME = "Action";
public static final QName WSAW_ACTION_QNAME =
new QName(WSA_NAMESPACE_WSDL_NAME, WSAW_ACTION_NAME);
http://git-wip-us.apache.org/repos/asf/cxf/blob/cf5a6d6e/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
----------------------------------------------------------------------
diff --git a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
index c546edf..9cef853 100644
--- a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
+++ b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
@@ -855,7 +855,8 @@ public class MAPCodec extends AbstractSoapInterceptor {
}
} else if (maps.getRelatesTo() == null
&& maps.getAction() != null
- && Names.WSA_DEFAULT_FAULT_ACTION.equals(maps.getAction().getValue())) {
+ && (Names.WSA_DEFAULT_FAULT_ACTION.equals(maps.getAction().getValue())
+ || Names.WSA_DEFAULT_SOAP_FAULT_ACTION.equals(maps.getAction().getValue()))) {
//there is an Action header that points to a fault and no relatesTo. Use the out map for the ID
Message m = message.getExchange().getOutMessage();
maps = ContextUtils.retrieveMAPs(m, false, true, false);
[3/3] cxf git commit: Recording .gitmergeinfo Changes
Posted by dk...@apache.org.
Recording .gitmergeinfo Changes
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4406683d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4406683d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4406683d
Branch: refs/heads/3.1.x-fixes
Commit: 4406683dfcd824a2be8a9986e2d2f04b18a6f551
Parents: cf5a6d6
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Apr 4 12:53:29 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue Apr 4 12:53:47 2017 -0400
----------------------------------------------------------------------
.gitmergeinfo | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/4406683d/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 162d40f..001925d 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -328,6 +328,7 @@ B f98785bd8490c4717353f1a9688cae3e7a823ec2
B fb11380da6e5c157ffd311c2925eb533d134c8cb
B fb30f8bffc85fcc3208fcc0e1eda4b54a89b5d37
B fd77d3f3380f805db3547d37cbb2ff72bd033ad0
+M 00148006c5bc489794f2774134fcbebf1cd5f2f4
M 01cd14ce923f1f2cd044746e272b2d525c46f9a6
M 01d06cee06203b0ba616ca1924f1878aecc1a791
M 01fdc40526185ee89202692088fd5367f0690af0
@@ -346,6 +347,7 @@ M 08c9194ce2c567ebfe59f59ee628b1197d90fd43
M 090fa6100ae3a5aa8ae894b0e238acb793f705ec
M 09fb22b25333c66514f06652ceaf7fc11bde51cc
M 0e5fd5a54cb271ba494e7e30b45d4228b33364a9
+M 10d34e1a812ab2a709376f008c738de68c8720cf
M 10ed38c6d1f74f75ae231e8b91b7198b4e162ab3
M 11637433df089a638e173d1ef57441e7456cf2ea
M 1184e08f0d1c40c754e39fd5d6340d1057fbdd17