mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-21 12:26:31 +00:00
fix[net]:还原制表符
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user