From 1ecf2dda4195ff00b2dadd98a7c12df6f362a731 Mon Sep 17 00:00:00 2001 From: huazhongming Date: Sat, 2 Feb 2019 11:42:20 +0800 Subject: [PATCH] event of response fix#3244 (#3247) --- .../java/org/apache/dubbo/remoting/exchange/Response.java | 4 ++++ .../apache/dubbo/remoting/exchange/codec/ExchangeCodec.java | 2 +- .../remoting/transport/codec/DeprecatedExchangeCodec.java | 2 +- .../java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java index d1ed88b1251..568ecf1160b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Response.java @@ -137,6 +137,10 @@ public void setEvent(String event) { mResult = event; } + public void setEvent(boolean mEvent) { + this.mEvent = mEvent; + } + public boolean isHeartbeat() { return mEvent && HEARTBEAT_EVENT == mResult; } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java index 7eb64a12667..8f25250c98e 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java @@ -142,7 +142,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro // decode response. Response res = new Response(id); if ((flag & FLAG_EVENT) != 0) { - res.setEvent(Response.HEARTBEAT_EVENT); + res.setEvent(true); } // get status. byte status = header[3]; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java index 36b58316589..552222db982 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java @@ -136,7 +136,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro // decode response. Response res = new Response(id); if ((flag & FLAG_EVENT) != 0) { - res.setEvent(Response.HEARTBEAT_EVENT); + res.setEvent(true); } // get status. byte status = header[3]; diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java index 9c1e2fc2f25..8a1b5ed1fc7 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java @@ -68,7 +68,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro // decode response. Response res = new Response(id); if ((flag & FLAG_EVENT) != 0) { - res.setEvent(Response.HEARTBEAT_EVENT); + res.setEvent(true); } // get status. byte status = header[3];