From 4d0eb41e32e9ed1dd4e8c0f2bb35e30b562bd033 Mon Sep 17 00:00:00 2001 From: chenyu <15253963@qq.com> Date: Tue, 23 Jul 2019 21:32:43 +0800 Subject: [PATCH 1/3] heartbeatData is null --- .../dubbo/remoting/exchange/codec/ExchangeCodec.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 8f25250c98e..387f6d29194 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 @@ -152,7 +152,8 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro if (status == Response.OK) { Object data; if (res.isHeartbeat()) { - data = decodeHeartbeatData(channel, in); + // data = decodeHeartbeatData(channel, in); + data = null; } else if (res.isEvent()) { data = decodeEventData(channel, in); } else { @@ -378,7 +379,11 @@ protected void encodeData(ObjectOutput out, Object data) throws IOException { } private void encodeEventData(ObjectOutput out, Object data) throws IOException { - out.writeObject(data); + if(data != null) { + out.writeObject(data); + }else{ + logger.warn("encodeEventData data is null"); + } } @Deprecated From 52f51e5bfdb553ecebd20e8b1fc9d26d14a0c1bd Mon Sep 17 00:00:00 2001 From: chenyu <15253963@qq.com> Date: Wed, 24 Jul 2019 14:49:10 +0800 Subject: [PATCH 2/3] heartbeatData is null --- .../dubbo/remoting/exchange/codec/ExchangeCodec.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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 387f6d29194..c3e18efc6f2 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 @@ -152,8 +152,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro if (status == Response.OK) { Object data; if (res.isHeartbeat()) { - // data = decodeHeartbeatData(channel, in); - data = null; + data = decodeHeartbeatData(channel, in); } else if (res.isEvent()) { data = decodeEventData(channel, in); } else { @@ -414,11 +413,7 @@ protected Object decodeEventData(Channel channel, ObjectInput in) throws IOExcep @Deprecated protected Object decodeHeartbeatData(Channel channel, ObjectInput in) throws IOException { - try { - return in.readObject(); - } catch (ClassNotFoundException e) { - throw new IOException(StringUtils.toString("Read object failed.", e)); - } + return Response.HEARTBEAT_EVENT; } protected Object decodeRequestData(Channel channel, ObjectInput in) throws IOException { From f501c60408dd375213f9fcaf103ea820e869307d Mon Sep 17 00:00:00 2001 From: chenyu <15253963@qq.com> Date: Thu, 25 Jul 2019 18:53:26 +0800 Subject: [PATCH 3/3] heartbeatData is null --- .../apache/dubbo/remoting/exchange/codec/ExchangeCodec.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 c3e18efc6f2..f16eb71863c 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 @@ -378,11 +378,7 @@ protected void encodeData(ObjectOutput out, Object data) throws IOException { } private void encodeEventData(ObjectOutput out, Object data) throws IOException { - if(data != null) { - out.writeObject(data); - }else{ - logger.warn("encodeEventData data is null"); - } + out.writeObject(data); } @Deprecated