From 856af71f46e70d24994b8dc4e30040407fa0d790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=B1=8C=E5=93=A5?= <564139153@qq.com> Date: Sun, 5 Mar 2023 23:56:14 +0800 Subject: [PATCH] =?UTF-8?q?fix[net]:=E8=BF=98=E5=8E=9F=E5=88=B6=E8=A1=A8?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zfoo/net/session/Session.java | 140 +++++++++--------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/net/src/main/java/com/zfoo/net/session/Session.java b/net/src/main/java/com/zfoo/net/session/Session.java index 1ec8b6d1..b00d2431 100644 --- a/net/src/main/java/com/zfoo/net/session/Session.java +++ b/net/src/main/java/com/zfoo/net/session/Session.java @@ -25,91 +25,91 @@ import java.util.concurrent.atomic.AtomicLong; */ public class Session implements Closeable { - private static final AtomicLong ATOMIC_LONG = new AtomicLong(0); + private static final AtomicLong ATOMIC_LONG = new AtomicLong(0); - /** - * The globally unique ID of the session - */ - private long sid; + /** + * The globally unique ID of the session + */ + private long sid; - private Channel channel; + private Channel channel; - /** - * EN:The default user ID is an ID greater than 0, or equal 0 if there is no login, user extra parameters - * CN:默认用户的id都是大于0的id,如果没有登录则等于0,用户额外参数 - */ - private long uid = 0; + /** + * EN:The default user ID is an ID greater than 0, or equal 0 if there is no login, user extra parameters + * CN:默认用户的id都是大于0的id,如果没有登录则等于0,用户额外参数 + */ + private long uid = 0; - /** - * EN:Session extra parameters - * CN:Session附带的属性参数,消费者的属性 - */ - private RegisterVO consumerAttribute = null; + /** + * EN:Session extra parameters + * CN:Session附带的属性参数,消费者的属性 + */ + private RegisterVO consumerAttribute = null; - public Session(Channel channel) { - if (channel == null) { - throw new IllegalArgumentException("channel cannot be empty"); - } - this.sid = ATOMIC_LONG.incrementAndGet(); - if (this.sid <= 0) { - throw new IllegalArgumentException("sid cannot be 0"); - } - this.channel = channel; - } + public Session(Channel channel) { + if (channel == null) { + throw new IllegalArgumentException("channel cannot be empty"); + } + this.sid = ATOMIC_LONG.incrementAndGet(); + if (this.sid <= 0) { + throw new IllegalArgumentException("sid cannot be 0"); + } + this.channel = channel; + } - @Override - public String toString() { - return StringUtils.format("[sid:{}] [uid:{}] [channel:{}]", sid, uid, channel); - } + @Override + public String toString() { + return StringUtils.format("[sid:{}] [uid:{}] [channel:{}]", sid, uid, channel); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Session session = (Session) o; - return sid == session.sid; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Session session = (Session) o; + return sid == session.sid; + } - @Override - public int hashCode() { - return (int) sid; - } + @Override + public int hashCode() { + return (int) sid; + } - @Override - public void close() { - channel.close(); - } + @Override + public void close() { + channel.close(); + } - public long getSid() { - return sid; - } + public long getSid() { + return sid; + } - public void setSid(long sid) { - this.sid = sid; - } + public void setSid(long sid) { + this.sid = sid; + } - public Channel getChannel() { - return channel; - } + public Channel getChannel() { + return channel; + } - public long getUid() { - return uid; - } + public long getUid() { + return uid; + } - public void setUid(long uid) { - this.uid = uid; - } + public void setUid(long uid) { + this.uid = uid; + } - public RegisterVO getConsumerAttribute() { - return consumerAttribute; - } + public RegisterVO getConsumerAttribute() { + return consumerAttribute; + } - public void setConsumerAttribute(RegisterVO consumerAttribute) { - this.consumerAttribute = consumerAttribute; - } + public void setConsumerAttribute(RegisterVO consumerAttribute) { + this.consumerAttribute = consumerAttribute; + } }