Revert "手动释放对象"

This reverts commit 458c216a6d.
This commit is contained in:
Guoqs
2024-12-29 12:54:05 +08:00
parent 874388b405
commit a4d553c6ef

View File

@@ -8,7 +8,6 @@ import com.jsowell.netty.service.electricbicycles.EBikeBusinessService;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.*; import io.netty.channel.*;
import io.netty.handler.timeout.ReadTimeoutException; import io.netty.handler.timeout.ReadTimeoutException;
import io.netty.util.ReferenceCountUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -61,7 +60,6 @@ public class ElectricBicyclesServerHandler extends ChannelInboundHandlerAdapter
*/ */
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object message) throws Exception { public void channelRead(ChannelHandlerContext ctx, Object message) throws Exception {
try {
byte[] msg = (byte[]) message; byte[] msg = (byte[]) message;
// 处理数据 // 处理数据
byte[] response = eBikeService.process(msg, ctx); byte[] response = eBikeService.process(msg, ctx);
@@ -81,10 +79,6 @@ public class ElectricBicyclesServerHandler extends ChannelInboundHandlerAdapter
// BytesUtil.binary(response, 16)); // BytesUtil.binary(response, 16));
// } // }
} }
} finally {
ReferenceCountUtil.release(message);
}
} }
/** /**