我很乐意提供帮助,了解在我使用Ping RoundTripTip时建立TCP连接需要多长时间:
根据维基百科,TCP连接将分三步建立:
1.SYN-SENT (=>CLIENT TO SERVER)
2.SYN/ACK-RECEIVED (=>SERVER TO CLIENT)
3.ACK-SENT (=>CLIENT TO SERVER)
Run Code Online (Sandbox Code Playgroud)
我的问题:
是正确的,第三次传输(ACK-SENT)还没有携带任何有效载荷(我的数据),但仅用于连接建立.(这导致结论,第四个包装将是第一个包装任何有效载荷....)
假设,当我的Ping RoundTripTime是20毫秒时,在上面给出的示例中,TCP连接建立至少需要30毫秒,在客户端和服务器之间传输任何数据之前是否正确?
非常感谢你
汤姆
是
final Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
Run Code Online (Sandbox Code Playgroud)
同样的
volatile Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
Run Code Online (Sandbox Code Playgroud)
如果内部Map由不同的线程访问?
或者甚至是这样的要求:
volatile Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
volatile Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
Run Code Online (Sandbox Code Playgroud)
如果它不是一个"级联"地图,那么final和volatile最终会产生同样的效果,即所有线程总是看到Map的正确内容......但是如果Map iteself包含一个map,会发生什么?在示例中...如何使内部地图正确"内存瘫痪"?
坦克!汤姆