|
@@ -10,14 +10,19 @@ import java.util.concurrent.ConcurrentMap;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import com.ym.mec.util.json.JsonUtil;
|
|
|
+import com.yonge.netty.server.service.UserChannelContextService;
|
|
|
|
|
|
@Component
|
|
|
public class NettyChannelManager {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(NettyChannelManager.class);
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserChannelContextService userChannelContextService;
|
|
|
|
|
|
/**
|
|
|
* {@link Channel#attr(AttributeKey)} 属性中,表示 Channel 对应的用户
|
|
@@ -83,6 +88,9 @@ public class NettyChannelManager {
|
|
|
* @param channel Channel
|
|
|
*/
|
|
|
public void remove(Channel channel) {
|
|
|
+
|
|
|
+ userChannelContextService.remove(channel);
|
|
|
+
|
|
|
// 移除 channels
|
|
|
channels.remove(channel.id());
|
|
|
|