mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-11 16:26:40 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -26,6 +26,10 @@ public class SignalAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 0;
|
||||
|
||||
/**
|
||||
* EN:Negative signalId are allowed
|
||||
* CN:允许负数的signalId
|
||||
*/
|
||||
public static final AtomicInteger ATOMIC_ID = new AtomicInteger(0);
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,9 +28,9 @@ public class Session implements Closeable {
|
||||
private static final AtomicLong ATOMIC_LONG = new AtomicLong(0);
|
||||
|
||||
/**
|
||||
* The globally unique ID of the session
|
||||
* The globally unique ID of the session and the negative sid are allowed
|
||||
*/
|
||||
private long sid;
|
||||
private long sid = ATOMIC_LONG.incrementAndGet();
|
||||
|
||||
private Channel channel;
|
||||
|
||||
@@ -52,10 +52,6 @@ public class Session implements Closeable {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -91,10 +87,6 @@ public class Session implements Closeable {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(long sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class SessionManager implements ISessionManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session getServerSession(long id) {
|
||||
return serverSessionMap.get(id);
|
||||
public Session getServerSession(long sid) {
|
||||
return serverSessionMap.get(sid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,8 +105,8 @@ public class SessionManager implements ISessionManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session getClientSession(long id) {
|
||||
return clientSessionMap.get(id);
|
||||
public Session getClientSession(long sid) {
|
||||
return clientSessionMap.get(sid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -330,7 +330,7 @@ public abstract class ReflectionUtils {
|
||||
var methodName = "get" + StringUtils.capitalize(fieldName);
|
||||
|
||||
try {
|
||||
clazz.getDeclaredMethod(methodName, null);
|
||||
clazz.getDeclaredMethod(methodName);
|
||||
return methodName;
|
||||
} catch (NoSuchMethodException e) {
|
||||
// java的get方法对boolean值有可能对应get或者is,所以尝试获取两种不同的get方法,当两种都获取不到才抛异常
|
||||
@@ -340,14 +340,14 @@ public abstract class ReflectionUtils {
|
||||
// 如果属性名以大写字母开头,属性名直接用作 getter/setter 方法中 get/set 的后部分。例如属性名为Name,对应的方法是getName/setName。
|
||||
methodName = "get" + fieldName;
|
||||
try {
|
||||
clazz.getDeclaredMethod(methodName, null);
|
||||
clazz.getDeclaredMethod(methodName);
|
||||
return methodName;
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
|
||||
methodName = "is" + StringUtils.capitalize(fieldName);
|
||||
try {
|
||||
clazz.getDeclaredMethod(methodName, null);
|
||||
clazz.getDeclaredMethod(methodName);
|
||||
return methodName;
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new RunException("field:[{}] has no getMethod or isMethod in class:[{}]", field.getName(), clazz.getCanonicalName());
|
||||
|
||||
Reference in New Issue
Block a user