|
|
|
|
@ -11,6 +11,7 @@ import java.net.InetSocketAddress;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 所有的客户端的chanel
|
|
|
|
|
@ -23,20 +24,20 @@ public class ClientChanel {
|
|
|
|
|
/**
|
|
|
|
|
* key : 巷道标识符
|
|
|
|
|
*/
|
|
|
|
|
private static Map<String, Channel> channelMap = new HashMap<>();
|
|
|
|
|
private static Map<String, Channel> channelMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* key :IP
|
|
|
|
|
* value: 巷道标识符
|
|
|
|
|
*/
|
|
|
|
|
private static Map<String,String> IP_SRMNumberMap = new HashMap<>();
|
|
|
|
|
private static Map<String,String> IP_SRMNumberMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* key :巷道标识符
|
|
|
|
|
* value: IP
|
|
|
|
|
*/
|
|
|
|
|
private static Map<String,String> SRMNumber_IPMap = new HashMap<>();
|
|
|
|
|
private static Map<String,String> SRMNumber_IPMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
public static void putIp(String ip,String ID){
|
|
|
|
|
IP_SRMNumberMap.put(ip,ID);
|
|
|
|
|
@ -63,6 +64,7 @@ public class ClientChanel {
|
|
|
|
|
InetSocketAddress socketAddress = (InetSocketAddress) channel.remoteAddress();
|
|
|
|
|
String clientIp = socketAddress.getAddress().getHostAddress();
|
|
|
|
|
putSRMNUmber_Ip(SRMNumber, clientIp);
|
|
|
|
|
log.info("connect 巷道 ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void disConnect(String key){
|
|
|
|
|
|