diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java index abd058294b3..e5d233aa9ce 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java @@ -95,8 +95,12 @@ public boolean isEvent() { } public void setEvent(String event) { - mEvent = true; - mData = event; + this.mEvent = true; + this.mData = event; + } + + public void setEvent(boolean mEvent) { + this.mEvent = mEvent; } public boolean isBroken() { 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 4031688e04e..7eb64a12667 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 @@ -43,9 +43,6 @@ /** * ExchangeCodec. - * - * - * */ public class ExchangeCodec extends TelnetCodec { @@ -176,7 +173,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro req.setVersion(Version.getProtocolVersion()); req.setTwoWay((flag & FLAG_TWOWAY) != 0); if ((flag & FLAG_EVENT) != 0) { - req.setEvent(Request.HEARTBEAT_EVENT); + req.setEvent(true); } try { ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java index f79d99df504..059fdaa04e6 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java @@ -126,7 +126,7 @@ public static void sent(Channel channel, Request request) { * @param channel channel to close */ public static void closeChannel(Channel channel) { - for (Map.Entry entry: CHANNELS.entrySet()) { + for (Map.Entry entry : CHANNELS.entrySet()) { if (channel.equals(entry.getValue())) { DefaultFuture future = getFuture(entry.getKey()); if (future != null && !future.isDone()) { @@ -255,7 +255,6 @@ private void invokeCallback(ResponseCallback c) { if (callbackCopy == null) { throw new NullPointerException("callback cannot be null."); } - c = null; Response res = response; if (res == null) { throw new IllegalStateException("response cannot be null. url:" + channel.getUrl()); 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 1dce90c8158..36b58316589 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 @@ -167,7 +167,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro req.setVersion(Version.getProtocolVersion()); req.setTwoWay((flag & FLAG_TWOWAY) != 0); if ((flag & FLAG_EVENT) != 0) { - req.setEvent(Request.HEARTBEAT_EVENT); + req.setEvent(true); } try { ObjectInput in = CodecSupport.deserialize(channel.getUrl(), is, proto); 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 d6a8e14ed39..9c1e2fc2f25 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 @@ -114,7 +114,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro req.setVersion(Version.getProtocolVersion()); req.setTwoWay((flag & FLAG_TWOWAY) != 0); if ((flag & FLAG_EVENT) != 0) { - req.setEvent(Request.HEARTBEAT_EVENT); + req.setEvent(true); } try { Object data; @@ -145,6 +145,7 @@ protected Object decodeBody(Channel channel, InputStream is, byte[] header) thro req.setBroken(true); req.setData(t); } + return req; } }