This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 09f795a8d1e313b467819496459efd7fe6efe6ed Author: Gilvan Filho <[email protected]> AuthorDate: Mon Dec 5 19:23:51 2022 -0300 (chores) camel-atmosphere-websocket: replace inner class with lambda --- .../atmosphere/websocket/WebsocketProducer.java | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java index 9a561a91c25..4799911cfcb 100644 --- a/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java +++ b/components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketProducer.java @@ -112,21 +112,18 @@ public class WebsocketProducer extends DefaultProducer { private void sendMessage(final WebSocket websocket, final Object message) { if (websocket != null && message != null) { - executor.execute(new Runnable() { - @Override - public void run() { - try { - if (message instanceof String) { - websocket.write((String) message); - } else if (message instanceof byte[]) { - websocket.write((byte[]) message, 0, ((byte[]) message).length); - } else { - // this should not happen unless one of the supported types is missing above. - LOG.warn("unexpected message type {}", message.getClass()); - } - } catch (Exception e) { - LOG.error("Error when writing to websocket", e); + executor.execute(() -> { + try { + if (message instanceof String) { + websocket.write((String) message); + } else if (message instanceof byte[]) { + websocket.write((byte[]) message, 0, ((byte[]) message).length); + } else { + // this should not happen unless one of the supported types is missing above. + LOG.warn("unexpected message type {}", message.getClass()); } + } catch (Exception e) { + LOG.error("Error when writing to websocket", e); } }); }
