你看到的entity.getcontentlength返回-1了

   你看到的entity.getcontentlength返回-1了,baidu了?看到类似的这篇文章了--》http://blog.csdn.net/ffm83/article/details/41944921

然后,你信了?就这么的解释了?或者就这么的不拘泥于细节直接换成了

EntityUtils.toString(entity).length(); 了?


你怎么玩我不知道,也可以说达到了目的就ok,不纠结细节有时候也是对的,但是,怀着憧憬,我按照那篇文章试了下,结果,console输出的是(当有一个线程的时候)

use the new method,the content length is:-1

是的,还是,,,,,,-1


但是如果是多个线程(比如我修改为10),结果为:

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:4905

use the new method,the content length is:4905

use the new method,the content length is:4905

use the new method,the content length is:4905

use the new method,the content length is:4905


当然,那篇文章里面对于header的设置是需要的,否则就会是:

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

use the new method,the content length is:-1

所以,这一句:

 // httpget.setHeader("Accept-Encoding", "identity")

还是不能注释掉的,它的作用还是存在着价值的。

那这个地方到底又是哪里有了问题,为何一个线程的时候就是-1呢?

executeservice.execute(work)执行对应的Runnable-》run()方法,应该也是预期的4905(本例子)


看官,如若你知道,请不吝赐教

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值