perf[net]: 优化SignalPacketAttachment的equals和hashcode方法,提升性能并且避免box和unbox

This commit is contained in:
jaysunxiao committed 2021-09-30 15:51:59 +08:00
1 parent 374cef9a7e
commit 7fec12b3b9
1 file changed
+2 -3
@@ -16,7 +16,6 @@ package com.zfoo.net.packet.model;
import com.zfoo.protocol.IPacket;
import com.zfoo.scheduler.util.TimeUtils;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
@@ -94,12 +93,12 @@ public class SignalPacketAttachment implements IPacketAttachment {
return false;
}
SignalPacketAttachment that = (SignalPacketAttachment) o;
return Objects.equals(packetId, that.packetId);
return packetId == that.packetId;
}
@Override
public int hashCode() {
return Objects.hash(packetId);
return packetId;
}
public int getPacketId() {