You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/01/13 10:09:04 UTC
[camel] branch camel-3.0.x updated (c153797 -> 00c6044)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a change to branch camel-3.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git.
from c153797 CAMEL-14372: Fixed file util to not compact http url
new dfef008 CAMEL-14390: Ensure websocket-jsr356 producer invokes AsyncCallback.done
new 00c6044 CAMEL-14390: Move AsyncCallback.done to finally block
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/camel/websocket/jsr356/JSR356Producer.java | 12 +++++++-----
.../apache/camel/websocket/jsr356/JSR356ProducerTest.java | 2 --
2 files changed, 7 insertions(+), 7 deletions(-)
[camel] 01/02: CAMEL-14390: Ensure websocket-jsr356 producer
invokes AsyncCallback.done
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-3.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit dfef008777d5917d9dd98dc52cfe269e9eefa333
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 13 09:09:58 2020 +0000
CAMEL-14390: Ensure websocket-jsr356 producer invokes AsyncCallback.done
---
.../org/apache/camel/websocket/jsr356/JSR356Producer.java | 11 ++++++-----
.../org/apache/camel/websocket/jsr356/JSR356ProducerTest.java | 2 --
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
index 566c3f3..1a8b1d0 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
@@ -49,7 +49,7 @@ public class JSR356Producer extends DefaultAsyncProducer {
final Session session = exchange.getIn().getHeader(JSR356Constants.SESSION, Session.class);
if (session != null && exchange.getIn().getHeader(JSR356Constants.USE_INCOMING_SESSION, false, Boolean.class)) {
synchronized (session) {
- doSend(exchange, session);
+ doSend(exchange, callback, session);
}
} else {
onExchange.accept(exchange, callback);
@@ -68,14 +68,15 @@ public class JSR356Producer extends DefaultAsyncProducer {
final ClientEndpointConfig.Builder clientConfig = ClientEndpointConfig.Builder.create();
manager = new ClientSessions(sessionCount, URI.create(endpointKey), clientConfig.build(), null);
manager.prepare();
- onExchange = (ex, cb) -> manager.execute(session -> doSend(ex, session));
+ onExchange = (exchange, callback) -> manager.execute(session -> doSend(exchange, callback, session));
}
- private void doSend(final Exchange ex, final Session session) {
+ private void doSend(final Exchange exchange, final AsyncCallback callback, final Session session) {
try {
- JSR356WebSocketComponent.sendMessage(session, ex.getIn().getBody());
+ JSR356WebSocketComponent.sendMessage(session, exchange.getIn().getBody());
+ callback.done(true);
} catch (final IOException e) {
- ex.setException(e);
+ exchange.setException(e);
}
}
diff --git a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
index 8c2769a..aebcbfd 100644
--- a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
+++ b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
@@ -32,7 +32,6 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.meecrowave.Meecrowave;
import org.apache.meecrowave.junit.MeecrowaveRule;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -54,7 +53,6 @@ public class JSR356ProducerTest extends CamelTestSupport {
@Produce("direct:ensureServerModeSendsProperly")
private ProducerTemplate serverProducer;
- @Ignore
@Test
public void ensureServerModeSendsProperly() throws Exception {
final String body = getClass().getName() + "#" + testName.getMethodName();
[camel] 02/02: CAMEL-14390: Move AsyncCallback.done to finally block
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-3.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 00c60443745037ce7fd583ff1e31347094d65096
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 13 09:34:15 2020 +0000
CAMEL-14390: Move AsyncCallback.done to finally block
---
.../main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
index 1a8b1d0..f74361c 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
@@ -74,9 +74,10 @@ public class JSR356Producer extends DefaultAsyncProducer {
private void doSend(final Exchange exchange, final AsyncCallback callback, final Session session) {
try {
JSR356WebSocketComponent.sendMessage(session, exchange.getIn().getBody());
- callback.done(true);
} catch (final IOException e) {
exchange.setException(e);
+ } finally {
+ callback.done(true);
}
}