标签:net static 服务 set 移动端 oschina http read article
网上未见针对移动端的浏览器并发数统计,可见的帖子数据全部来自于 StackOverflow 关于主机浏览器的一篇描述。static private final AtomicLong SEQ = new AtomicLong(0);
@RequestMapping(value = "sleep/{s}", method = GET)
public Result<Long> sleepForSeconds(@PathVariable("s") int secondNum)
{
long index = SEQ.incrementAndGet();
try { Thread.sleep(secondNum * 1000); }
catch (InterruptedException iex) { }
Result<Long> result = new Result<>();
result.setData(index);
result.setSuccess(true);
return result;
}
前端(JavaScript with jQuery)
<div id="area_display"></div>
<script>
var nowInMillis = new Date().getTime();
for (var i = -1; ++i != 28; )
{
$.get(apictx + ‘/try/sleep/4?t=‘ + nowInMillis + ‘_‘ + i).done(function(result)
{
var html = $(‘#area_display‘).html();
html += result.data + ‘(use ‘;
html += new Date().getTime() - nowInMillis + ‘ms)<br />‘;
$(‘#area_display‘).html(html);
});
}
</script>
本文还发表于在其它网站
CSDN :https://blog.csdn.net/ShaneLooLi/article/details/104123946
ITeye :https://www.iteye.com/blog/user/surmounting/blog/2512203
中国开源社区:https://my.oschina.net/shane1984/blog/3162224
标签:net static 服务 set 移动端 oschina http read article
原文地址:https://blog.51cto.com/shanelooli/2468681