Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Bughue committed Nov 16, 2023
1 parent 8577d01 commit e0bf2d0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/io/seata/core/protocol/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static byte calcProtocolVersion(String sdkVersion) throws IncompatibleVer
long v0 = convertVersion(VERSION_0_7_1);
if (version <= v0) {
return ProtocolConstants.VERSION_0;
}else {
} else {
return ProtocolConstants.VERSION_1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exce
if (msg instanceof ProtocolRpcMessage) {
rpcMessage = ((ProtocolRpcMessage) msg).protocolMsg2RpcMsg();
processMessage(ctx, rpcMessage);
}else {
} else {
LOGGER.error("rpcMessage type error");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
package io.seata.core.rpc.netty.v0;

import io.netty.buffer.ByteBuf;
import io.seata.core.protocol.AbstractIdentifyRequest;
import io.seata.core.protocol.AbstractMessage;
import io.seata.core.protocol.MessageTypeAware;

/**
* The interface Message codec.
*
* @author jimin.jm @alibaba-inc.com
* @date 2018 /9/14
* @author Bughue
* @date 2023/11/01
*/
public interface MessageCodecV0<T> extends MessageTypeAware {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public void encode(RpcMessage message, ByteBuf out) {
Serializer serializer = SerializerServiceLoader.load(SerializerType.getByCode(codec), ProtocolConstants.VERSION_0);
bodyBytes = serializer.serialize(msg.getBody());

if(msg.isSeataCodec()){
if(msg.getBody() instanceof MessageTypeAware){
if (msg.isSeataCodec()) {
if (msg.getBody() instanceof MessageTypeAware) {
short typeCode = ((MessageTypeAware) msg.getBody()).getTypeCode();
out.writeShort(typeCode);
}
}else {
} else {
out.writeShort(bodyBytes.length);
}
out.writeLong(msg.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.seata.core.rpc.netty.v1;

import io.seata.common.util.StringUtils;
import io.seata.core.protocol.AbstractIdentifyRequest;
import io.seata.core.protocol.RpcMessage;
import io.seata.core.rpc.netty.ProtocolRpcMessage;

Expand All @@ -30,7 +29,6 @@
* @date 2023/8/1
**/
public class ProtocolRpcMessageV1 implements ProtocolRpcMessage {

private int id;
private byte messageType;
private byte codec;
Expand Down Expand Up @@ -175,7 +173,7 @@ public String toString() {
}

@Override
public RpcMessage protocolMsg2RpcMsg(){
public RpcMessage protocolMsg2RpcMsg() {
RpcMessage rpcMessage = new RpcMessage();
rpcMessage.setId(this.id);
rpcMessage.setMessageType(this.messageType);
Expand Down

0 comments on commit e0bf2d0

Please sign in to comment.