From f6791108246d54599d9a04c9ce27673fadab0de5 Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Sun, 27 Jan 2019 17:33:37 +0100 Subject: [PATCH] Minor refactor in MessageImpl --- .../io/vertx/core/eventbus/impl/MessageImpl.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/vertx/core/eventbus/impl/MessageImpl.java b/src/main/java/io/vertx/core/eventbus/impl/MessageImpl.java index 179f48f9378..621efc92489 100644 --- a/src/main/java/io/vertx/core/eventbus/impl/MessageImpl.java +++ b/src/main/java/io/vertx/core/eventbus/impl/MessageImpl.java @@ -106,10 +106,7 @@ public String replyAddress() { @Override public void fail(int failureCode, String message) { - if (replyAddress != null) { - sendReply(bus.createMessage(true, replyAddress, null, - new ReplyException(ReplyFailure.RECIPIENT_FAILURE, failureCode, message), null), null, null); - } + reply(new ReplyException(ReplyFailure.RECIPIENT_FAILURE, failureCode, message)); } @Override @@ -130,7 +127,8 @@ public void reply(Object message, DeliveryOptions options) { @Override public void reply(Object message, DeliveryOptions options, Handler>> replyHandler) { if (replyAddress != null) { - sendReply(bus.createMessage(true, replyAddress, options.getHeaders(), message, options.getCodecName()), options, replyHandler); + MessageImpl reply = bus.createMessage(true, replyAddress, options.getHeaders(), message, options.getCodecName()); + bus.sendReply(reply, this, options, replyHandler); } } @@ -147,10 +145,6 @@ public MessageCodec codec() { return messageCodec; } - protected void sendReply(MessageImpl msg, DeliveryOptions options, Handler>> replyHandler) { - bus.sendReply(msg, this, options, replyHandler); - } - protected boolean isLocal() { return true; }