mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-02 22:18:08 +00:00
fix[net]:还原制表符
This commit is contained in:
@@ -25,91 +25,91 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
*/
|
*/
|
||||||
public class Session implements Closeable {
|
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
|
* The globally unique ID of the session
|
||||||
*/
|
*/
|
||||||
private long sid;
|
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
|
* 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,用户额外参数
|
* CN:默认用户的id都是大于0的id,如果没有登录则等于0,用户额外参数
|
||||||
*/
|
*/
|
||||||
private long uid = 0;
|
private long uid = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EN:Session extra parameters
|
* EN:Session extra parameters
|
||||||
* CN:Session附带的属性参数,消费者的属性
|
* CN:Session附带的属性参数,消费者的属性
|
||||||
*/
|
*/
|
||||||
private RegisterVO consumerAttribute = null;
|
private RegisterVO consumerAttribute = null;
|
||||||
|
|
||||||
public Session(Channel channel) {
|
public Session(Channel channel) {
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
throw new IllegalArgumentException("channel cannot be empty");
|
throw new IllegalArgumentException("channel cannot be empty");
|
||||||
}
|
}
|
||||||
this.sid = ATOMIC_LONG.incrementAndGet();
|
this.sid = ATOMIC_LONG.incrementAndGet();
|
||||||
if (this.sid <= 0) {
|
if (this.sid <= 0) {
|
||||||
throw new IllegalArgumentException("sid cannot be 0");
|
throw new IllegalArgumentException("sid cannot be 0");
|
||||||
}
|
}
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return StringUtils.format("[sid:{}] [uid:{}] [channel:{}]", sid, uid, channel);
|
return StringUtils.format("[sid:{}] [uid:{}] [channel:{}]", sid, uid, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o == null || getClass() != o.getClass()) {
|
if (o == null || getClass() != o.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Session session = (Session) o;
|
Session session = (Session) o;
|
||||||
return sid == session.sid;
|
return sid == session.sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (int) sid;
|
return (int) sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
channel.close();
|
channel.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSid() {
|
public long getSid() {
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSid(long sid) {
|
public void setSid(long sid) {
|
||||||
this.sid = sid;
|
this.sid = sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel getChannel() {
|
public Channel getChannel() {
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUid() {
|
public long getUid() {
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUid(long uid) {
|
public void setUid(long uid) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisterVO getConsumerAttribute() {
|
public RegisterVO getConsumerAttribute() {
|
||||||
return consumerAttribute;
|
return consumerAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConsumerAttribute(RegisterVO consumerAttribute) {
|
public void setConsumerAttribute(RegisterVO consumerAttribute) {
|
||||||
this.consumerAttribute = consumerAttribute;
|
this.consumerAttribute = consumerAttribute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user